| IP_ADD_MEMBERSHIP(2const) | IP_ADD_MEMBERSHIP(2const) |
NAME¶
IP_ADD_MEMBERSHIP - join a multicast group
LIBRARY¶
Standard C library (libc, -lc)
SYNOPSIS¶
#include <netinet/in.h> /* Definition of IP* constants */ #include <sys/socket.h>
int setsockopt(int sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
const struct ip_mreqn *val, sizeof(struct ip_mreqn));
DESCRIPTION¶
Join a multicast group.
IP_ADD_MEMBERSHIP is valid only for setsockopt(2).
ERRORS¶
See IPPROTO_IP(2const). See setsockopt(2). See ip(7).
- EINVAL
- val->imr_multiaddr is not a valid multicast address.
HISTORY¶
Linux 1.2.
For compatibility, the old ip_mreq structure is still supported. The kernel determines which structure is being passed based on the size passed in the last argument.
SEE ALSO¶
IPPROTO_IP(2const), ip_mreqn(2type), setsockopt(2), ip(7)
| 2025-11-25 | Linux man-pages (unreleased) |