标签:gets return cas family soc multicast ast span lag
#include <errno.h> #include <net/if.h> #include <sys/socket.h> #include <netinet/in.h> int sockfd_to_family(int); int mcast_get_loop(int sockfd) { switch (sockfd_to_family(sockfd)) { case AF_INET: { u_char flag; socklen_t len; len = sizeof(flag); if (getsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &flag, &len) < 0) { return(-1); } return (flag); } #ifdef IPV6 case AF_INET6: { u_int flag; socklen_t len; len = sizeof(flag); if (getsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &flag, &len) < 0) { return(-1); } return (flag); } #endif default: { errno = EAFNOSUPPORT; return(-1); } } }
标签:gets return cas family soc multicast ast span lag
原文地址:https://www.cnblogs.com/soldierback/p/10804854.html