![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
网络编程
nw4869
i m just a kid
展开
-
C语言使用socket通过IP138获取外网IP
WORD wVersionRequested; WSADATA wsaData; wVersionRequested = MAKEWORD( 1, 1 ); WSAStartup( wVersionRequested, &wsaData );void getNetIp(char *ip){ //创建连向服务器的套接字 SOCKET sock = socket(AF_INE原创 2014-05-02 18:01:14 · 2600 阅读 · 0 评论 -
C语言SOCKET获取本机所有IP
void printHostIp(){ char hostName[255]; char *ip; PHOSTENT hostinfo; gethostname(hostName, sizeof(hostName)); hostinfo = gethostbyname(hostName); printf("Your all IP address are\n"); for(原创 2014-05-02 18:02:42 · 2038 阅读 · 0 评论