How to get domain name from Given IP in MFC (VC++)?
问题 How to get domain name from Given IP in MFC (VC++) ? The code i am using is as below: #include "stdafx.h" #include <winsock2.h> #include <ws2tcpip.h> #include <stdio.h> // link with ws2_32.lib #pragma comment(lib, "Ws2_32.lib") int _tmain(int argc, char **argv) { //----------------------------------------- // Declare and initialize variables WSADATA wsaData = {0}; int iResult = 0; DWORD dwRetval; struct sockaddr_in saGNI; char hostname[NI_MAXHOST]; char servInfo[NI_MAXSERV]; u_short port =