[转]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. 揭秘TPM安全芯片技术及加密应用

    揭秘TPM安全芯片技术及加密应用 首发:http://safe.it168.com/a2012/0912/1396/000001396884.shtml 从2003年开始,重要数据丢失已经成为严重的信 ...

  2. C# winform编程中多线程操作控件方法

    private void Form1_Load(object sender, EventArgs e) { Thread newthread = new Thread(new ThreadStart( ...

  3. Android knock code analysis

    My colleague she forgot the knock code and ask me for help. I know her phone is LG G3 D855 with Andr ...

  4. js怎样改变div的宽度

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. MFC创建对话框组件对应变量并进行设置值(VS2010)

    m_path = strFolderPath; UpdateData(FALSE);

  6. nginx负载均衡配置一(反向代理)

    一.前提 1:系统linux(centos) 2:nginx代理服务器(web:192.168.1.10  proxy.abc.com) 3:nginx后台服务器(web1:192.168.1.11 ...

  7. atexit注册的函数是在main函数之后执行?

    跟atexit函数相识已久,man手册里对atexit的解释是这么一段: The atexit() function registers the given function to be called ...

  8. sqoop导入数据到hive---2

    1.hive-table 从mysql导入数据到hive表中,可以使用--hive-table来指定hive的表名,不指定hive表名,则hive表名与mysql表名保持一致. sqoop impor ...

  9. LogStash 中字段的排除和数据的排除

    排除字段 字段的排除需要在filter中进行操作,使用一个叫做 mutate 的工具,具体操作如下 由于这个工具的名字不是很容易联想到,也是找了好一会. //比如我们可能需要避免日志中kafka的一些 ...

  10. shopnc二次开发(一)

    ---恢复内容开始--- 以前没有怎么接触过shopnc,感觉界面挺漂亮的,不过后来自己需要开发一个电商系统,就顺便参考了下,感觉构架垃圾的一塌糊涂.不过平时做这个系统二次开发的业务比较多,所以简单的 ...