ip_multicast_if的作用

选项IP_MULTICAST_IF用于设置组播的默认默认网络接口,会从给定的网络接口发送,另一个网络接口会忽略此数据。默认的网络接口是哪一个?另一个又是哪一个?这个选项的应用场合是什么?

A Tutorial on IP Multicast
 
http://ntrg.cs.tcd.ie/undergrad/4ba2/multicast/antony/

 
Introduction
This tutorial assumes basic familiarity with the socket programming abstraction foun......
答案就在这里:A Tutorial on IP Multicast
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

   IP_MULTICAST_IF: if the socket do bind to any local ip, then the os will fill the source ipaddr as the the following one.                           

struct in_addr localInterface;

localInterface.s_addr = inet_addr(LOCAL_ADDR);

if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, (char *) &localInterface, sizeof(localInterface)) <0)

{

         perror("setsockopt():IP_MULTICAST_IF ");

         return -1;

}

http://baike.baidu.com/link?url=3a0LAFqj5hvEd2fzd_vjpQSt_07YDlKyhITLzfcCLdR_YmczeYkck6kf3_rhdDoq8zd_58ty_3SNAIyX-IjES_