mcast_get_if函数

Posted soldierback

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mcast_get_if函数相关的知识,希望对你有一定的参考价值。

#include    <errno.h>

int sockfd_to_family(int);

int mcast_get_if(int sockfd)
{
    switch (sockfd_to_family(sockfd)) {
        case AF_INET: {
        /* TODO: similar to mcast_set_if() */
            return(-1);
        }

#ifdef    IPV6
        case AF_INET6: {
            u_int        idx;
            socklen_t    len;

            len = sizeof(idx);
            if (getsockopt(sockfd, IPPROTO_IPV6, 
                IPV6_MULTICAST_IF, &idx, &len) < 0) {
                return(-1);
            }
            return(idx);
        }
#endif
        default: {
            errno = EAFNOSUPPORT;
            return (-1);
        }
    }
}

 

以上是关于mcast_get_if函数的主要内容,如果未能解决你的问题,请参考以下文章