Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2634564
  • 博文数量: 333
  • 博客积分: 4817
  • 博客等级: 上校
  • 技术积分: 4413
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-28 10:51
文章分类

全部博文(333)

文章存档

2017年(20)

2016年(57)

2015年(27)

2014年(20)

2013年(21)

2012年(164)

2011年(24)

分类: 嵌入式

2016-12-06 14:16:24

当执行这个函数时:
setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP,&mreq, sizeof(mreq));
perror("error:");
打印错误:setsockopt:no such device

度娘原因:
What does "IP_ADD_MEMBERSHIP: No such device" mean? 

It means that the tool is trying to use multicast but the network interface doesn't support it There are two likely causes: 
·Your machine doesn't have multicast support enabled. For example, on Linux and FreeBSD it is possible to compile a kernel which doesn't support multicast.  
·You don't have a route for multicast traffic. Some systems don't add this by default, and you need to run:
route add -net 224.0.0.0 netmask 224.0.0.0 eth0(or similar). If you wish to use RAT in unicast mode only, it is possible to add the multicast route on the loopback interface.


我的板子是ZC706,刚开始,还以为是kernel不支持组播,运行了route add -net 224.0.0.0 netmask 224.0.0.0 eth0命令后,OK!!!
阅读(12395) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~