In addition to the setsockopt
options specified in
SUSv3, setsockopt
also supports the options specified here.
The following setsockopt
operations are provided for
level IPPROTO_IP:
Set or reads the time-to-live value of outgoing multicast packets for this socket. optval is a pointer to an integer which contains the new TTL value.
Sets a boolean flag indicating whether multicast packets originating locally should be looped back to the local sockets. optval is a pointer to an integer which contains the new flag value.
Join a multicast group.
optval is a pointer to a
ip_mreq
structure. Before calling, the
caller should fill in the imr_multiaddr
field with the multicast group address and the
imr_address
field with the address of the local
interface. If imr_address
is set to INADDR_ANY,
then an appropriate interface is chosen by the system.
Leave a multicast group.
optval is a pointer to a
ip_mreq
structure containing the same values as were
used with IP_ADD_MEMBERSHIP.
Set the local device for a multicast socket.
optval is a pointer to a
ip_mreq
structure initialized in the same manner as
with IP_ADD_MEMBERSHIP.
The ip_mreq
structure contains two
struct in_addr
fields:
imr_multiaddr
and
imr_address
.