CodePudding user response:
Post code, mapCodePudding user response:
WSAData WSAData;WSAStartup (MAKEWORD (2, 0), & amp; WsaData);
Char ipp [4].
Ipp [0]=192;
Ipp [1]=168;
Ipp [2]=0;
Ipp [3]=100;
HOSTENT * lpHostEnt;
In_addr ina;
LpHostEnt=gethostbyaddr (ipp, sizeof (ipp), AF_INET);
ShowMessage (lpHostEnt - & gt; H_name);//display the host name
WSACleanup ();
Including 192.168.0.100 is the machine's IP, this return "" bogon" "
But if change the IP to 127.0.0.1 can return the machine name correctly,,
CodePudding user response:
Run with administrator try it?