rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWMulticastSocket Class Reference
[Essential Networking Module]

Extends RWSocket to provide support for multicast UDP sockets. More...

#include <rw/network/RWMulticastSocket.h>

Inheritance diagram for RWMulticastSocket:
RWSocket

List of all members.

Public Member Functions

 RWMulticastSocket ()
 RWMulticastSocket (const RWSockType &socketType)
 RWMulticastSocket (SOCKET existingSocket)
RWMulticastSocketoperator= (const RWSocket &socket)
void joinGroup (const RWInetAddr &group, const RWInetAddr &localAddr=RWInetAddr())
void joinGroup (const RWInet6Addr &group, unsigned int inter=0)
void leaveGroup (const RWInetAddr &group, const RWInetAddr &localAddr=RWInetAddr())
void leaveGroup (const RWInet6Addr &group, unsigned int inter=0)
void setInterface (const RWInetAddr &inter)
void setInterface (unsigned int inter)
void setScope (unsigned int scope)
void setLoopback (bool loop)

Detailed Description

RWMulticastSocket is derived from RWSocket, providing an extended interface to support multicast UDP sockets.


Constructor & Destructor Documentation

RWMulticastSocket::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::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::RWMulticastSocket ( SOCKET  existingSocket  ) 

Creates an RWSocket that encapsulates the C socket.


Member Function Documentation

void RWMulticastSocket::joinGroup ( const RWInet6Addr group,
unsigned int  inter = 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.

Condition:
This method is available only on systems that support IPv6-based socket addresses.
void RWMulticastSocket::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 RWMulticastSocket::leaveGroup ( const RWInet6Addr group,
unsigned int  inter = 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.

Condition:
This method is available only on systems that support IPv6-based socket addresses.
void RWMulticastSocket::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.

RWMulticastSocket& RWMulticastSocket::operator= ( const RWSocket socket  ) 

Assignment operator.

void RWMulticastSocket::setInterface ( unsigned int  inter  ) 

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.

Condition:
This method is available only on systems that support IPv6-based socket addresses.
void RWMulticastSocket::setInterface ( const RWInetAddr inter  ) 

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 RWMulticastSocket::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.

void RWMulticastSocket::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.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.