→ purincess:可以給一下你的code嗎@@? 搞不好你傳ip的使用方式是錯的 12/20 22:15
→ xatier:DNS? 12/20 22:28
謝謝大家的幫忙
以下是我的code
struct sockaddr_in _addr;
memset(&_addr, 0, sizeof(struct sockaddr_in));
_addr.sin_family = AF_INET;
_addr.sin_addr.s_addr = inet_addr(szIP.c_str());
struct hostent* _hptr = gethostbyaddr((const char*)&_addr,sizeof(struct
sockaddr_in), AF_INET);
if(_hptr==NULL) return;
std::cout << _hptr->h_name << std::endl;
int i=0;
while(_hptr->h_aliases[i]!=NULL)
{std::cout << _hptr->h_aliases[i++] << std::endl;}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.220.71.34
→ purincess:gethostbyaddr是要傳in_addr*不是sockaddr_in*吧 XD 12/21 10:22
→ meconin:did you try "nslookup"? what's the result? 12/21 10:41
→ ireullin:nslookup 的結果是connection timed out; no servers cou 12/21 17:08
→ ireullin:請問這是否代表這個網域裡頭不能rdns? 12/21 17:09
→ meconin:It's maybe the problem caused by dns-server. I suggest 12/22 19:11