您的位置:首页 > 其它

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....
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐