[转]IP_ADD_MEMBERSHIP : 组播错误 的解决方法:

http://www.cnitblog.com/dvb-dvb/archive/2012/10/15/aa.html

by default live library includes winsock.h through windows.h instead of winsock2.h, but requires Winsock 2 in  initializeWinsockIfNecessary(...) function.
IP_ADD_MEMBERSHIP value for Winsock1 is 5, and for Winsock 2 is 12.
Therefore
socketJoinGroup(...) function is trying to call
setsockopt(IP_ADD_MEMBERSHIP) from Winsock 2 with optname from Winsock
1.
There is the confusion between Winsock versions.

live555的 组播的code如下 :

testAddr.s_addr = our_inet_addr("228.67.43.91"); // arbitrary
      Port testPort(15947); // ditto

sock = setupDatagramSocket(env, testPort);
      if (sock < 0) break;

if (!socketJoinGroup(env, sock, testAddr.s_addr))
   {
    env<<"Failed to socket Join Group\n";
    break;
   }

结果:

if (setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
   (const char*)&imr, sizeof (struct ip_mreq)) < 0) {

一直失败:错误提示为: 10042:

修改为: if (setsockopt(socket, IPPROTO_IP, 12,
   (const char*)&imr, sizeof (struct ip_mreq)) < 0) {

因为不同的socket版本,定义IP_ADD_MEMBERSHIP 的值不同:

in socket ver1.0中:
#define IP_ADD_MEMBERSHIP 5

in socket ver2.0中:
#define IP_ADD_MEMBERSHIP 12

[转]IP_ADD_MEMBERSHIP : 组播错误 的解决方法:的更多相关文章

  1. centos linux 系统日常管理4 scp,rsync,md5sum,sha1sum,strace ,find Rsync 常见错误及解决方法 第十七节课

    centos linux 系统日常管理4  scp,rsync,md5sum,sha1sum,strace ,find Rsync 常见错误及解决方法  第十七节课 rsync可以增量同步,scp不行 ...

  2. 运维实战案例之“Too many open files”错误与解决方法

    运维实战案例之"Too many open files"错误与解决方法   技术小甜 2017-11-16 15:02:00 浏览869 服务器 shell tomcat 脚本 o ...

  3. Eclipse启动时发生An internal error occurred during: "Initializing Java Tooling".错误的解决方法

    问题描述: Eclipse启动时发生An internal error occurred during: "Initializing JavaTooling".错误的解决方法 解决 ...

  4. GCC-4.6.3编译linux2.6.32.12内核出现“重复的成员‘page’”错误的解决方法

    使用gcc4.6.3编译linux2.6.32.12内核出现错误如下: In file included from drivers/net/igbvf/ethtool.c:36:0: drivers/ ...

  5. Linux系统Vsftp 传文件出现 553 Could Not Create File错误的解决方法

    解决方法: 登录出现了这个错误提示:553 Could not create file SELinux设置如下 查看SELinux设置 [root@localhost ~]# getsebool -a ...

  6. [转]权限问题导致Nginx 403 Forbidden错误的解决方法

    权限问题导致Nginx 403 Forbidden错误的解决方法 投稿:junjie 字体:[增加 减小] 类型:转载 时间:2014-08-22 这篇文章主要介绍了权限问题导致Nginx 403 F ...

  7. ueditor上传大容量视频报http请求错误的解决方法

    故障现象: 当使用百度编辑器ueditor上传大容量视频或大容量图片的时候,编辑器报"http请求错误"的解决方法详解: 原因分析: 目前很多CMS整合了百度的ueditor编辑器 ...

  8. window10 安装出现the error code is 2503错误的解决方法

    window10 安装出现the error code is 2503错误的解决方法:  设置 C:\WINDOWS\TEMP的权限

  9. MyEclipse+Tomcat 启动时出现A configuration error occured during startup错误的解决方法

    MyEclipse+Tomcat 启动时出现A configuration error occured during startup错误的解决方法 分类: javaweb2013-06-03 14:4 ...

随机推荐

  1. .Net性能优化时应该关注的数据

    解决性能问题的时候,我往往会让客户添加下面一些计数器进行性能收集. Process object下的所有计数器: Processor object下的所有计数器: System object下的所有计 ...

  2. ajax success 和complete 的区别

    Function) success - 当请求成功时调用的函数.这个函数会得到一个参数:从服务器返回的数据(根据“dataType”进行了格式化). Function) complete - 当请求完 ...

  3. Linux 命令之 grep

    1:将/etc/passwd中有root字符的行显示出来 [root@bogon zkero]# grep -n 'root' /etc/passwd :root:x:::root:/root:/bi ...

  4. [my]_ubuntu12.10_/etc/apt/sources.list

    deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse deb-src http://mirror ...

  5. DOM 中 Property 和 Attribute 的区别

    原文地址:http://web.jobbole.com/83129/ property 和 attribute非常容易混淆,两个单词的中文翻译也都非常相近(property:属性,attribute: ...

  6. 实例分析ELF文件静态链接

    参考文献: <ELF V1.2> <程序员的自我修养---链接.装载与库>第4章 静态链接 开发平台: [thm@tanghuimin static_link]$ uname ...

  7. nginx url重写 rewrite实例

    本文介绍下,在nginx中实现Url重写,学习rewrite的具体用法,有需要的朋友参考下吧. 原文地址:http://www.360doc.com/content/14/0202/20/142341 ...

  8. CSS3新增伪类

    p:last-of-type         选择其父元素的最后的一个P元素 p:last-child            选择其父元素的最后子元素(一定是P才行) p:first-of-type ...

  9. wcf调用oracle存储过程

    public IList<ACCP_RAIN> QueryAll(string beginTime, string endTime, string type) { beginTime = ...

  10. Android计时器TimerTask,Timer,Handler

    Android计时器TimerTask,Timer,若要在TimerTask中更新主线程UI,鉴于Android编程模型不允许在非主线程中更新主线程UI,因此需要结合Android的Handler实现 ...