在linux下播放组播流出现setsockopt:No such device错误是因为多播IP没有add路由表里面
可以采用如下命令完成:
root@android:/ # busybox route add -net 239.1.1.0 netmask 239.1.1.0 dev eth0 busybox route add -net 239.1.1.0 netmask 239.1.1.0 dev eth0 route: bogus netmask 239.1.1.0 1|root@android:/ # busybox route add default gw "192.168.1.198" dev eth0 busybox route add default gw "192.168.1.198" dev eth0 root@android:/ #
完整的命令如下:
C:\Users\Administrator>adb shell adb server is out of date. killing... * daemon started successfully * root@android:/ # busybox ifconfig eth0 192.168.1.198 busybox ifconfig eth0 192.168.1.198 root@android:/ # busybox ifconfig eth0 busybox ifconfig eth0 eth0 Link encap:Ethernet HWaddr 1E:ED:19:27:1A:B3 inet addr:192.168.1.198 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::1ced:19ff:fe27:1ab3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:133 errors:0 dropped:0 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:13782 (13.4 KiB) TX bytes:3615 (3.5 KiB) root@android:/ # busybox netsh int ipv6 show interface busybox netsh int ipv6 show interface netsh: applet not found 1|root@android:/ # busybox route busybox route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 root@android:/ # busybox route add 239.1.1.0 mask 255.255.255.0 192.168.1.198 -p k 255.255.255.0 192.168.1.198 -p < route: invalid option -- 'p' BusyBox v1.15.3 (2011-11-25 17:55:55 CST) multi-call binary Usage: route [{add|del|delete}] Edit kernel routing tables Options: -n Don't resolve names -e Display other/more information -A inet{6} Select address family 1|root@android:/ # busybox route add 239.1.1.0 mask 255.255.255.0 192.168.1.198 sk 255.255.255.0 192.168.1.198 < BusyBox v1.15.3 (2011-11-25 17:55:55 CST) multi-call binary Usage: route [{add|del|delete}] Edit kernel routing tables Options: -n Don't resolve names -e Display other/more information -A inet{6} Select address family 1|root@android:/ # route add -net 224.0.0.0 netmask 224.0.0.0 eth0 route add -net 224.0.0.0 netmask 224.0.0.0 eth0 Invalid argument 22|root@android:/ # route add -net 239.1.1.0 netmask 239.1.1.0 eth0 route add -net 239.1.1.0 netmask 239.1.1.0 eth0 Invalid argument 22|root@android:/ # busybox route add -net 239.1.1.0 netmask 239.1.1.0 eth0 busybox route add -net 239.1.1.0 netmask 239.1.1.0 eth0 route: bogus netmask 239.1.1.0 1|root@android:/ # netstat -ng netstat -ng Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:5037 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:46036 127.0.0.1:14089 ESTABLISHED tcp6 0 0 :::14087 :::* LISTEN tcp6 0 0 :::14088 :::* LISTEN tcp6 0 0 :::14089 :::* LISTEN tcp6 0 0 :::14092 :::* LISTEN tcp6 0 4 ::ffff:127.0.0.1:14089 ::ffff:127.0.0.1:46036 ESTABLISHED tcp6 0 0 ::ffff:127.0.0.1:14088 ::ffff:127.0.0.1:39454 TIME_WAIT root@android:/ # ifconfig ifconfig root@android:/ # busybox ifconfig busybox ifconfig eth0 Link encap:Ethernet HWaddr 1E:ED:19:27:1A:B3 inet addr:192.168.1.198 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::1ced:19ff:fe27:1ab3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:358850 errors:0 dropped:0 overruns:0 frame:0 TX packets:38 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:488018720 (465.4 MiB) TX bytes:6367 (6.2 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:5330 errors:0 dropped:0 overruns:0 frame:0 TX packets:5330 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:352540 (344.2 KiB) TX bytes:352540 (344.2 KiB) root@android:/ # busybox route add -net 239.1.1.0 netmask 239.1.1.0 dev eth0 busybox route add -net 239.1.1.0 netmask 239.1.1.0 dev eth0 route: bogus netmask 239.1.1.0 1|root@android:/ # busybox route add default gw "192.168.1.198" dev eth0 busybox route add default gw "192.168.1.198" dev eth0 root@android:/ #