boost::corosio::socket_option::leave_group
Leave a multicast group (IP_DROP_MEMBERSHIP / IPV6_LEAVE_GROUP).
Synopsis
Declared in <boost/corosio/socket_option.hpp>
class leave_group;
Description
The group's family — not the socket's — selects the wire struct and protocol level, mirroring join_group.
Example
void
stop_receiving_an_ipv4_multicast_group(corosio::udp_socket& sock)
{
// Precondition: sock is open on family::v4 and joined this group.
//
// Membership otherwise lasts until the socket closes. The group and the
// interface have to match the join_group that established it --
// attempting to leave a (group, interface) pair the kernel has no
// membership for fails with EADDRNOTAVAIL, which set_option reports by
// throwing.
sock.set_option(
corosio::socket_option::leave_group(
corosio::ipv4_address("239.255.0.1")));
}
Member Functions
Name |
Description |
|
Constructors |
Created with MrDocs