对方的机器是ADSL拨号上网,IP动态获得。然后他们通过花生壳服务设置了一个域名来对应此动态IP。
怎么样通过这个域名获得其当前的IP呢?
怎么样通过这个域名获得其当前的IP呢?
解决方案 »
- 想把程序这部分改成多线程,不知道怎么个改法
- 急:ADO +ACCESS插入出错!
- 如何加入使用次数的限制
- 我想双击对话框的标题栏,把对话框放到固定的位置,是不是用SetWindowPos,但是如何来做呢?
- 多语言问题!(高手指教)
- 1>VPSASPMSDlg.obj : error LNK2001: 无法解析的外部符号 "class CPtrList m_lsProjectList" (?
- 做一个简单的cad软件(用vc6),需要哪些资料,哪儿有?
- 求教,对话框中一个tab页面如何访问其他页面中的数据?
- 请问如何在对话框中画图?
- 象SHGetDiskFreeSpace 这样带有SH开头的函数 是什么函数啊!!
- [win32]我用CreateWindow创建了一格空白窗口,又使用createWindow在窗口上创建了一个按钮,但是我怎么知道这个按钮被按下?
- 如何删除没有价值的帖子?
const char FAR *name
);
name
[in] Pointer to the null-terminated name of the host to resolve.
{
HOSTENT* hst=NULL;
struct in_addr ia;
int iDomainLength = _tcslen(sDomain) + 1;
char* lpsDomain = new char[iDomainLength];
ZeroMemory(lpsDomain,iDomainLength);
#ifdef _UNICODE
WideCharToMultiByte(CP_ACP,
0,
sDomain,
-1,
lpsDomain,
iDomainLength,
NULL,
NULL);
#else
strcpy(sDomain,lpsDomain);
#endif
hst = gethostbyname(lpsDomain);
if(hst != NULL)
{
memcpy(&ia.s_addr,hst->h_addr_list[0],sizeof(ia.s_addr));
int iIpLength = strlen(inet_ntoa(ia)) + 1;
char* lpcIp = new char[iIpLength];
ZeroMemory(lpcIp,iIpLength);
strcpy(lpcIp,inet_ntoa(ia));
#ifdef _UNICODE
MultiByteToWideChar(CP_ACP,0,lpcIp,iIpLength,sIp,iIpLength);
#else
strcpy(sIp,lpcIp);
#endif
delete[] lpcIp;
// _stprintf(sIp,"%s",inet_ntoa(ia));
}
delete[] lpsDomain;
}
www.163.com的IP是202.108.9.16
C:\Documents and Settings\ABC>ping www.163.comPinging www.cache.split.netease.com [202.108.9.16] with 32 bytes of data:Reply from 202.108.9.16: bytes=32 time=37ms TTL=55
Reply from 202.108.9.16: bytes=32 time=38ms TTL=55
Reply from 202.108.9.16: bytes=32 time=31ms TTL=55
Reply from 202.108.9.16: bytes=32 time=32ms TTL=55Ping statistics for 202.108.9.16:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 31ms, Maximum = 38ms, Average = 34msC:\Documents and Settings\ABC>