标签:char class style err col include multicast ret net
#include <errno.h> #include <sys/socket.h> #include <net/if.h> #include <netinet/in.h> int sockfd_to_family(int); int mcast_set_loop(int sockfd, int onoff) { switch (sockfd_to_family(sockfd)) { case AF_INET: { u_char flag; flag = onoff; return(setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &flag, sizeof(flag))); } #ifdef IPV6 case AF_INET6: { u_int flag; flag = onoff; return(setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &flag, sizeof(flag))); } #endif default: { errno = EAFNOSUPPORT; return(-1); } } }
标签:char class style err col include multicast ret net
原文地址:https://www.cnblogs.com/soldierback/p/10804841.html