http://blog.csdn.net/guanghua2_0beta/article/details/52483916

sendto() 向广播地址发包返回errno 13, Permission denied错误

sendto()向广播地址发包返回errno 13, Permission denied错误

原因:
没有设置socket的SO_BROADCAST属性。特别注意:SO_BROADCAST属性要单独设置,一般习惯setsockopt时同时设置多个属性,例如SO_BROADCAST|SO_REUSEADDR,虽然大部分情况下工作正常,但工作中还是遇到了同时设置不起作用的问题;
 
int ret;
int optval = ;
ret = setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &optval,sizeof(int));
if(ret!=)
{
printf("setsockopt SO_BROADCAST error:%d, %s\n", errno, strerror(errno));
close(sockfd);
return -;
}
ret = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &optval,sizeof(int));
if(ret!=)
{
close(sockfd);
return -;
}

sendto() 向广播地址发包返回errno 13, Permission denied错误的更多相关文章

  1. Python UDP broadcast PermissionError: [Errno 13] Permission denied

    /********************************************************************** * Python UDP broadcast Permi ...

  2. OSError: [Errno 13] Permission denied: '/etc/cron.d/1sandbox_registration'

    使用Hortonworks 的twitter tutorial: http://hortonworks.com/hadoop-tutorial/how-to-refine-and-visualize- ...

  3. nova-compute[5410]: OSError: [Errno 13] Permission denied: '图像路径'

    前几天有 openstack-Nova 创建虚拟机拨弄了一下,结果重新启动后的今天 nova boot 创建虚拟机实例有错误,创建虚拟机出状况  他们是 error 视图 openstack 服务状态 ...

  4. 如何解决 Django中出现的 [Errno 13] Permission denied问题

    环境:linux 如果你使用了Apache部署了Django项目,在上传文件时可能会出现 “[Errno 13] Permission denied:某目录”的错误. 这是因为apache没有权限在该 ...

  5. windows python flask上传文件出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads'的解决方法

    在浏览器中输入时,出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads' http://127.0.0.1: ...

  6. 报错:/usr/sbin/mysqld: Can't find file: './performance_schema/events_waits_summary_by_account_by_event_name.frm' (errno: 13 - Permission denied)

    报错背景: Linux环境下安装MySQL数据库. 安装完成,数据库初始化,启动数据库时报错. 报错现象: -- :: [ERROR] Native table 'performance_schema ...

  7. Jupyter运行时出现下面的错误:Unexpected error while saving file: arma/Untitled.ipynb [Errno 13] Permission denied:

    运行环境:Ubuntu16.04+Python2.7执行如下代码修改Jupyter的一部分文件的权限(执行完之后重新启动即可): sudo chmod ~/.local/share/jupyter/ ...

  8. OSError:[Errno 13] Permission denied:'my_library' 问题解决方法

    出现问题: 执行 rosrun rosserial_windows make_libraries.py my_library 命令时出现OSError:[Errno 13] Permission de ...

  9. Could not install packages due to an Environment Error: [Errno 13] Permission denied 解决方案

    执行pip install 报错如下: Could not install packages due to an Environment Error: [Errno 13] Permission de ...

随机推荐

  1. hdu 5288 OO’s Sequence(计数)

    Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the number o ...

  2. iPhone/iPad全屏截图与区域截图的几种方法

    本文由社区会员taonavy分享 截取本区域(self.view): UIGraphicsBeginImageContext(CGSizeMake(self.view.frame.size.width ...

  3. IDataParameter调用存储过程

    public string  GenerateExamePaper(string paperType, string driverID, string MacAddr)         {       ...

  4. 在后台操作标记的runat="server"的html标签

    价格: <input id="tbPrice" type="text" runat="server" /> HtmlInputT ...

  5. sqlite3安装

    SQLite命令行程序(CLP)是开始使用SQLite的最好选择,按照如下步骤获取CLP: 1).打开浏览器进入SQLite主页,www.sqlite.org. 2).单击页面顶部的下载链接(Down ...

  6. Josn转DataTable(转)

    使用UI框架开发的时候就常常用到DataTable转Json的情况,但是最近完成一个微信公众号开发的项目,需要把微信接口传过来的json值作为转为DataTable后绑定到服务器控件上. 在网上找了很 ...

  7. PHP学习笔记二十三【This】

    <?php Class Person { function test1() { $this->test2();//类里面的方法互相调用要加$this } protected functio ...

  8. 我的第一个QML Button的实现

    编写第一个QML,在成功跑完HelloWorld后,决定自己实现Button按钮类. Button是在Quick2版本以上的QtQuick Controls出现的. 在Qt5.5.1版本中,选择插入Q ...

  9. (转) eclipse debug (调试) 学习心得

    1.Step Into (also F5) 跳入2.Step Over (also F6) 跳过3.Step Return (also F7) 执行完当前method,然后return跳出此metho ...

  10. GDI 开发的准备工作

    1 需要的链接库和头文件 大部分函数在 Gdi.dll 和 Gdi32.dll 提供.相关的函数接口和结构都在 Wingdi.h 文件中(如果工程中已包含 Windows.h 就不需要再包含了,因为 ...