当前位置: 技术问答>linux和unix
linux下原始套接字创建失败
来源: 互联网 发布时间:2017-03-17
本文导语: 刚开始上网络课,老师让抓经过网卡数据包。 话说创建原始套接字一直失败,不知是何道理? int sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP | IPPROTO_UDP | IPPROTO_TCP); if(sock != -1) printf("%s","Ok,socket's created successfully"); ...
刚开始上网络课,老师让抓经过网卡数据包。
话说创建原始套接字一直失败,不知是何道理?
int sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP | IPPROTO_UDP | IPPROTO_TCP);
if(sock != -1) printf("%s","Ok,socket's created successfully");
话说创建原始套接字一直失败,不知是何道理?
int sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP | IPPROTO_UDP | IPPROTO_TCP);
if(sock != -1) printf("%s","Ok,socket's created successfully");
|
原始套接字好像只root用户可以创建吧,,所以sudo