获取本机IP
char name[255];
gethostname(name, sizeof(name));
CString ip;
LPHOSTENT lphost;
lphost = gethostbyname(name));
in_addr *pAddr;
pAddr = *ppAddr++;
ip.Format("%d.%d.%d.%d", pAddr->S_un.S_un_b.s_b1, pAddr->S_un.S_un_b.s_b2,pAddr->S_un.S_un_b.s_b3,pAddr->S_un.S_un_b.s_b4);