代码如下:#include <stdio> #include <winsock2> #pragma comment(lib, “WS2_32.lib”) int main() { char host_name[256]; // define host name (for example:xxx-PC) int WSA_return, i; WSADATA WSAData; HOSTENT *host_entry; // record host information WORD wVersionRequested; wVersionRe