gethostbyaddr segmentation error FAQ
2009-04-24 20:37
411 查看
p, li { white-space: pre-wrap; }
struct hostent* hostEnt;
hostEnt=gethostbyaddr(inet_ntoa(ptr->ip_src),sizeof(ptr->ip_src),AF_INET);
if(!hostEnt)
{
tmp=new QStandardItem("No Name");
Row.append(tmp);
}else
{
tmp=new QStandardItem(hostEnt->h_name);
Row.append(tmp);
}
above is right,but before I get to know this issue, I didn't check the hostEnt's value,so when there is no result to return , hostEnt-> operation will throw out segmentation error
note that....
struct hostent* hostEnt;
hostEnt=gethostbyaddr(inet_ntoa(ptr->ip_src),sizeof(ptr->ip_src),AF_INET);
if(!hostEnt)
{
tmp=new QStandardItem("No Name");
Row.append(tmp);
}else
{
tmp=new QStandardItem(hostEnt->h_name);
Row.append(tmp);
}
above is right,but before I get to know this issue, I didn't check the hostEnt's value,so when there is no result to return , hostEnt-> operation will throw out segmentation error
note that....
相关文章推荐
- Python之Dijango的“坑” hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' cod
- Python之Dijango的“坑” hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' cod
- perl函数说明(gethostbyaddr)
- 名字与地址(端口)转换——gethostbyname/gethostbyaddr(getservbyname/getservbyport)
- gethostbyname(),gethostbyaddr()的使用
- Linux下获得主机与域名-gethostbyname和gethostbyaddr
- gethostbyname, gethostbyaddr(原来百度叫shifen "十分?")
- gethostbyaddr使用时发生 11004 请求的名称有效,但是找不到请求的类型的数据。
- UNIX网络编程——名字与地址转换(gethostbyname,gethostbyaddr,getservbyname,getservbyport,getaddrinfo,getnameinfo函数)
- 《UNIX网络编程01》 第十一章 高级名字与地址转换 gethostbyname_r、gethostbyaddr_r
- socket网络编程之二:gethostbyname()和gethostbyaddr()用法
- struct hostent 结构体与gethostbyname(),gethostbyaddr
- 使用gethostbyaddr,通过ip地址,得到该ip地址的主机的信息
- 使用gethostbyaddr,通过ip地址,得到该ip地址的主机的信息
- python socket.gethostbyaddr socket.herror: [Errno 1] Unknown host
- UNIX网络编程——名字与地址转换(gethostbyname,gethostbyaddr,getservbyname,getservbyport,getaddrinfo,getnameinfo函数)
- getaddrinfo, getnameinfo(替代gethostbyname, gethostbyaddr), gethostname
- gethostbyname()和gethostbyaddr()函数说明
- getaddrinfo, getnameinfo(替代gethostbyname, gethostbyaddr), gethostname
- gethostbyaddr()