C++ Code
1 2 3 4 5 6 7 8 9 10 11 |
struct sockaddr_in servAddr;//linux 与 SOCKADDR_IN servAddr;//windows mreq.imr_multiaddr.s_addr//linux 与 mreq.imr_multiaddr.S_un.S_addr//windows int m = setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));//linux 与 int m = setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char FAR *)&mreq, sizeof(mreq));//windows |
时间: 2024-12-07 15:38:31