gethostbyaddr()怎麼用的啊?我這樣用怎麼不行啊?
gethostbyaddr()怎麼用的啊?我這樣用怎麼不行啊?
CString addr;
addr="10.132.227.131";
hostAddr=gethostbyaddr(addr,14,AF_INET );
if(hostAddr==NULL)
{
char * buf=new char[100];
strcpy(buf,"can't find the pc ip '");
strcat(buf,m_PcName);
strcat(buf,"'");
MessageBox(buf,"Error");
delete buf;
return;
}
CString sip;
sip.Format("%s",hostAddr->h_name);
m_monitor.InsertString(0,sip);
}