Run commands using CreateProcess in NT Services >>
<< Project
gethostbyname sample

Author Zhou Renjian Create@ 2004-11-14 13:32 Modified@ 2004-11-14 13:33
whizz Note icon

#include <winsock2.h>
...
   WORD wVersionRequested;
   WSADATA wsaData;
   char name[255] = "www.whizzideas.com";
   CString ip;
   PHOSTENT hostinfo;
   wVersionRequested = MAKEWORD(2, 0);


   if (WSAStartup(wVersionRequested, &wsaData) == 0 )
   {
    if((hostinfo = gethostbyname(name)) != NULL)
     ip = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list);
    WSACleanup();
   }
...

本记录所在类别:
本记录相关记录: