Module: Essential Networking Module Package: Networking
RWMulticastSocketRWSocket
#include <rw/network/RWMulticastSocket.h>
RWMulticastSocket is derived from RWSocket, providing an extended interface to support multicast UDP sockets.
RWMulticastSocket()
Default constructor. Sets the socket to an invalid state. You must initialize it with a call to socket(), connect(), bind(), or listen() before it can be used.
RWMulticastSocket(const RWSockType& socketType);
Creates an unconnected socket of the specified type. The resulting socket must be bound to an address using bind(), connect(), or listen() before it can be used.
NOTE -- In order to effectively take advantage of the methods provided in this class, the RWSockType instance should represent a UDP socket type.
RWMulticastSocket(SOCKET existingSocket);
Creates an RWSocket that encapsulates the C socket.
RWMulticastSocket&
operator=(const RWSocket& socket);
Assignment operator.
void joinGroup(const RWInetAddr& group,
const RWInetAddr& localAddr = RWInetAddr());
Joins an IPv4 multicast socket group. If localAddr is specified, then it will be used as the local interface for receiving messages from the group, otherwise an interface will be chosen by the system.
void joinGroup(const RWInet6Addr& group,
unsigned int interface = 0);
Joins an IPv6 multicast socket group. If interface is specified, it will be used as the local interface for receiving messages from the group, otherwise an interface will be chosen by the system.
NOTE -- This method is available only on systems that support IPv6-based socket addresses.
void leaveGroup(const RWInetAddr& group,
const RWInetAddr& localAddr = RWInetAddr());
Leaves an IPv4 mulitcast socket group. The arguments to this function should match those passed to joinGroup() when the socket joined the multicast group.
void leaveGroup(const RWInet6Addr& group,
unsigned int interface = 0);
Leaves an IPv6 multicast socket group. The arguments to this function should match those passed to joinGroup() when the socket joined the multicast group.
NOTE -- This method is available only on systems that support IPv6-based socket addresses.
void setInterface(const RWInetAddr& interface);
Sets the local IPv4 address to be used when sending messages to the multicast group. If an interface is not specified, the system will choose one.
void setInterface(unsigned int interface);
Sets the local IPv6 address to be used when sending messages to the multicast group. If an interface is not specified, the system will choose one.
NOTE -- This method is only available on systems that support IPv6-based socket addresses)
void setScope(unsigned int scope);
Sets the maximum number of hops a packet is allowed to travel. The value of this argument is treated differently depending on whether this is an IPv4 or IPv6 multicast socket. If it is IPv4 based, the scope sets the TTL field of the message header. If it is IPv6 based, the scope sets the maximum number of hops (times the packet will be forwarded by a router) on the message header.
void setLoopback(bool loop);
Determines whether messages sent from this socket will also be received by this socket (if it is a member of the same group), or will be sent only to other members of the group. If loop is true, the sending socket will receive the message as well. The default is true.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.