Boost C++ Libraries Home Libraries People FAQ More

Home | Reference | Tutorial | Examples | Design
Reference Index | Class Hierarchy | Class Index | Member Index

boost::asio::ip::multicast Namespace Reference


Detailed Description

The boost::asio::ip::multicast namespace defines the socket options used for multicast.


Typedefs

typedef implementation_defined join_group
 Socket option to join a multicast group on a specified interface.
typedef implementation_defined leave_group
 Socket option to leave a multicast group on a specified interface.
typedef implementation_defined outbound_interface
 Socket option for local interface to use for outgoing multicast packets.
typedef implementation_defined hops
 Socket option for time-to-live associated with outgoing multicast packets.
typedef implementation_defined enable_loopback
 Socket option determining whether outgoing multicast packets will be received on the same socket if it is a member of the multicast group.


Typedef Documentation

typedef implementation_defined boost::asio::ip::multicast::join_group

Socket option to join a multicast group on a specified interface.

Implements the IPPROTO_IP/IP_ADD_MEMBERSHIP socket option.

Examples:
Setting the option to join a multicast group:
 boost::asio::ip::udp::socket socket(io_service); 
 ...
 boost::asio::ip::address multicast_address =
   boost::asio::ip::address::from_string("225.0.0.1");
 boost::asio::ip::multicast::join_group option(multicast_address);
 socket.set_option(option);
Concepts:
Socket_Option, IP_MReq_Socket_Option.

typedef implementation_defined boost::asio::ip::multicast::leave_group

Socket option to leave a multicast group on a specified interface.

Implements the IPPROTO_IP/IP_DROP_MEMBERSHIP socket option.

Examples:
Setting the option to leave a multicast group:
 boost::asio::ip::udp::socket socket(io_service); 
 ...
 boost::asio::ip::address multicast_address =
   boost::asio::ip::address::from_string("225.0.0.1");
 boost::asio::ip::multicast::leave_group option(multicast_address);
 socket.set_option(option);
Concepts:
Socket_Option, IP_MReq_Socket_Option.

typedef implementation_defined boost::asio::ip::multicast::outbound_interface

Socket option for local interface to use for outgoing multicast packets.

Implements the IPPROTO_IP/IP_MULTICAST_IF socket option.

Examples:
Setting the option:
 boost::asio::ip::udp::socket socket(io_service); 
 ...
 boost::asio::ip::address_v4 local_interface =
   boost::asio::ip::address_v4::from_string("1.2.3.4");
 boost::asio::ip::multicast::outbound_interface option(local_interface);
 socket.set_option(option);
Concepts:
Socket_Option, IP_Network_Interface_Socket_Option.

typedef implementation_defined boost::asio::ip::multicast::hops

Socket option for time-to-live associated with outgoing multicast packets.

Implements the IPPROTO_IP/IP_MULTICAST_TTL socket option.

Examples:
Setting the option:
 boost::asio::ip::udp::socket socket(io_service); 
 ...
 boost::asio::ip::multicast::hops option(4);
 socket.set_option(option);
Getting the current option value:
 boost::asio::ip::udp::socket socket(io_service); 
 ...
 boost::asio::ip::multicast::hops option;
 socket.get_option(option);
 int ttl = option.get();
Concepts:
Socket_Option, Integer_Socket_Option.

typedef implementation_defined boost::asio::ip::multicast::enable_loopback

Socket option determining whether outgoing multicast packets will be received on the same socket if it is a member of the multicast group.

Implements the IPPROTO_IP/IP_MULTICAST_LOOP socket option.

Examples:
Setting the option:
 boost::asio::ip::udp::socket socket(io_service); 
 ...
 boost::asio::ip::multicast::enable_loopback option(true);
 socket.set_option(option);
Getting the current option value:
 boost::asio::ip::udp::socket socket(io_service); 
 ...
 boost::asio::ip::multicast::enable_loopback option;
 socket.get_option(option);
 bool is_set = option.get();
Concepts:
Socket_Option, Boolean_Socket_Option.

Copyright © 2003 - 2006 Christopher M. Kohlhoff


Home | Reference | Tutorial | Examples | Design