Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

MulticastSocket Class Reference

Inheritance diagram for MulticastSocket:

DatagramSocket List of all members.

Public Member Functions

void setLoopback (bool loopback)
void join (InternetAddress groupAddress)
void pauseGroup ()
void resumeGroup ()
void leave ()

Private Member Functions

 this ()
int read (IBuffer target, Address addr)
int read (IBuffer target)
int write (IBuffer source, Address to)

Private Attributes

InternetAddress groupAddress

Detailed Description

Wrapper around multicast style of sockets, to simplify the API a bit, and to tie them into the IBuffer construct. Note that when used with a SocketListener you must first join the MulticastSocket to a group. Do not bind() it yourself, since that is performed by the join() method.

Definition at line 56 of file MulticastSocket.d.


Member Function Documentation

void setLoopback bool  loopback  )  [inline]
 

Enable/disable the receipt of multicast packets send from the same socket

Definition at line 67 of file MulticastSocket.d.

References Socket::setOption().

void join InternetAddress  groupAddress  )  [inline]
 

Join a multicast group. This is necessary only for a multicast reciever (listener). You may call this for a send-only socket without harm, but the operation is completely superfluous.

Note that the socket will be bound to the specified port, and be listening on the provided class D address. Expect join() to fail without a network adapter present, or the NIC is not plugged into a router or switch.

Definition at line 87 of file MulticastSocket.d.

References Socket::bind(), InternetAddress::port(), resumeGroup(), and Socket::setAddressReuse().

Referenced by testMulticast().

void pauseGroup  )  [inline]
 

Remove this socket from the current group. Method join() is expected to have been invoked previously, otherwise this is a noop.

Definition at line 104 of file MulticastSocket.d.

References groupAddress.

Referenced by leave().

void resumeGroup  )  [inline]
 

Add this socket to the current group again. Method join() is expected to have been invoked previously, otherwise this is a noop.

Definition at line 119 of file MulticastSocket.d.

References groupAddress.

Referenced by join().

void leave  )  [inline]
 

Leave a multicast group. This should only be invoked on sockets that have already joined a multicast group, and before said socket joins another group.

There does not appear to be a means to unbind the socket from the port specified during the original join(); thus we have to create a new underlying socket before join() will bind() cleanly.

Definition at line 139 of file MulticastSocket.d.

References Socket::closure(), Socket::create(), groupAddress, and pauseGroup().

this  )  [inline, inherited]
 

Create an internet datagram socket

Reimplemented from Resource.

Definition at line 66 of file DatagramSocket.d.

int read IBuffer  target,
Address  addr
[inline, inherited]
 

Read the available bytes from datagram into the given IBuffer. The 'from' address will be populated appropriately

Definition at line 78 of file DatagramSocket.d.

References assert().

Referenced by DatagramSocket::read().

int read IBuffer  target  )  [inline, inherited]
 

Read the available bytes from datagram into the given IBuffer. The 'from' address will be populated appropriately

Reimplemented from ISocketReader.

Definition at line 100 of file DatagramSocket.d.

References DatagramSocket::read().

int write IBuffer  source,
Address  to
[inline, inherited]
 

Write content from the specified buffer to the given address.

Definition at line 113 of file DatagramSocket.d.

References assert().

Referenced by Cluster::broadcast(), and testMulticast().


Member Data Documentation

InternetAddress groupAddress [private]
 

Definition at line 58 of file MulticastSocket.d.

Referenced by leave(), pauseGroup(), and resumeGroup().


The documentation for this class was generated from the following file:
Generated on Fri May 27 18:12:02 2005 for Mango by  doxygen 1.4.0