Debian Codegraph @

upstream/debian-unstable/man2/IP_ADD_MEMBERSHIP.2const

raw
1 .\" Copyright, the authors of the Linux man-pages project
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH IP_ADD_MEMBERSHIP 2const 2025-11-25 "Linux man-pages 6.18"
6 .SH NAME
7 IP_ADD_MEMBERSHIP
8 \-
9 join a multicast group
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .BR "#include <netinet/in.h>" " /* Definition of " IP* " constants */"
16 .B #include <sys/socket.h>
17 .P
18 .BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_ADD_MEMBERSHIP,
19 .BI " const\~struct\~ip_mreqn\~*" val ,\~sizeof(struct\~ip_mreqn));
20 .fi
21 .SH DESCRIPTION
22 Join a multicast group.
23 .P
24 .B IP_ADD_MEMBERSHIP
25 is valid only for
26 .BR setsockopt (2).
27 .SH ERRORS
28 See
29 .BR IPPROTO_IP (2const).
30 See
31 .BR setsockopt (2).
32 See
33 .BR ip (7).
34 .TP
35 .B EINVAL
36 .I val->imr_multiaddr
37 is not a valid multicast address.
38 .SH HISTORY
39 Linux 1.2.
40 .P
41 For compatibility, the old
42 .I ip_mreq
43 structure is still supported.
44 The kernel determines which structure is being passed based
45 on the size passed in the last argument.
46 .SH SEE ALSO
47 .BR IPPROTO_IP (2const),
48 .BR ip_mreqn (2type),
49 .BR setsockopt (2),
50 .BR ip (7)