标签:
http://blog.csdn.net/guanghua2_0beta/article/details/52483916
sendto() 向广播地址发包返回errno 13, Permission denied错误
int ret; int optval = 1; ret = setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &optval,sizeof(int)); if(ret!=0) { printf("setsockopt SO_BROADCAST error:%d, %s\n", errno, strerror(errno)); close(sockfd); return -1; } ret = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &optval,sizeof(int)); if(ret!=0) { close(sockfd); return -1; }
sendto() 向广播地址发包返回errno 13, Permission denied错误
标签:
原文地址:http://www.cnblogs.com/LiuYanYGZ/p/5891155.html