#include <MulticastSocket.h++>


Public Member Functions | |
| MulticastSocket (uint16_t port=0) throw () | |
| Construct a new MulticastSocket bound to the given port. | |
| ~MulticastSocket () throw () | |
| Destructor. | |
| void | join (const String &address) throw (SocketException) |
| Join a multicast group. | |
| void | join (const InetAddress &address) throw (SocketException) |
| Join a multicast group. | |
| void | join (const String &address, const NetworkInterface &ixface) throw (SocketException) |
| Join a multicast group on a specific interface. | |
| void | join (const InetAddress &address, const NetworkInterface &ixface) throw (SocketException) |
| Join a multicast group on a specific interface. | |
| void | leave (const String &address) throw (SocketException) |
| Leave a multicast group. | |
| void | leave (const InetAddress &address) throw (SocketException) |
| Leave a multicast group. | |
| void | leave (const String &address, const ccxx::NetworkInterface &ixface) throw (SocketException) |
| Leave a multicast group on a specific interface. | |
| void | leave (const InetAddress &address, const ccxx::NetworkInterface &ixface) throw (SocketException) |
| Leave a multicast group on a specific interface. | |
| void | setTTL (uint8_t ttl) throw (SocketException) |
| Set the TTL (time-to-live) value for outgoing multicast datagrams. | |
| uint8_t | getTTL () const throw (SocketException) |
| Get the TTL value. | |
| void | setLoopbackEnabled (bool enabled) throw (SocketException) |
| Enable or disable local loopback of multicast datagrams. | |
| bool | isLoopbackEnabled () const throw (SocketException) |
| Determine if local loopback is enabled. | |
| void | connect (const String &addr, uint16_t port) throw (IOException) |
| Connect the datagram socket to a remote endpoint. | |
| void | connect (const SocketAddress &addr) throw (IOException) |
| Connect the datagram socket to a remote endpoint. | |
| size_t | send (const byte_t *buffer, size_t buflen) throw (IOException) |
| Send a datagram to the remote endpoint. | |
| size_t | send (ByteBuffer &buffer) throw (IOException) |
| Send a datagram to the remote endpoint. | |
| size_t | send (const byte_t *buffer, size_t buflen, const SocketAddress &dest) throw (IOException) |
| Send a datagram to a given address. | |
| size_t | send (ByteBuffer &buffer, const SocketAddress &dest) throw (IOException) |
| Send a datagram to a given address. | |
| size_t | receive (byte_t *buffer, size_t buflen) throw (IOException) |
| Receive a datagram from the remote endpoint, and write it to a buffer. | |
| size_t | receive (ByteBuffer &buffer) throw (IOException) |
| Receive a datagram from the remote endpoint, and write it to a buffer. | |
| size_t | receive (byte_t *buffer, size_t buflen, SocketAddress &source) throw (IOException) |
| Receive a datagram and write it to a buffer. | |
| size_t | receive (ByteBuffer &buffer, SocketAddress &source) throw (IOException) |
| Receive a datagram and write it to a buffer. | |
| void | setBroadcast (bool flag) throw (SocketException) |
| Enable or disable broadcast. | |
| bool | getBroadcast () const throw (SocketException) |
| Determine if broadcast is enabled. | |
| virtual void | init () throw (SocketException) |
| Initialize the socket. | |
| virtual void | shutdown () throw () |
| Shut down the socket. | |
| void | setTimeout (int msec) throw (SocketException) |
| Set the timeout for the socket. | |
| void | setReceiveBufSize (size_t size) throw (SocketException) |
| Set the size of the socket's internal receive buffer. | |
| size_t | getReceiveBufSize () const throw (SocketException) |
| Get the size of the socket's internal receive buffer. | |
| void | setSendBufSize (size_t size) throw (SocketException) |
| Set the size of the socket's internal send buffer. | |
| size_t | getSendBufSize () const throw (SocketException) |
| Get the size of the socket's internal send buffer. | |
| void | setLingerTime (int msec) throw (SocketException) |
| Set the linger time for the socket. | |
| int | getLingerTime () const throw (SocketException) |
| Get the linger time for the socket. | |
| void | setReuseAddress (bool enable) throw (SocketException) |
| Enable or disable the SO_REUSEADDR option on the socket. | |
| bool | getReuseAddress () const throw (SocketException) |
| Determine if the SO_REUSEADDR option is enabled or disabled. | |
| void | setKeepAlive (bool enable) throw (SocketException) |
| Enable or disable the SO_KEEPALIVE option on the socket. | |
| bool | getKeepAlive () throw (SocketException) |
| Determine if the SO_KEEPALIVE option is enabled or disabled. | |
| void | setTCPDelay (bool enable) throw (SocketException) |
| Enable or disable the Nagle algorithm for send coalescing. | |
| bool | getTCPDelay () throw (SocketException) |
| Determine if the Nagle algorithm is enabled or disabled. | |
| bool | isInitialized () const throw () |
| Determine if the socket has been initialized. | |
| bool | isConnected () const throw () |
| Determine if the socket is connected. | |
| NetProtocol | getType () const throw () |
| Get the socket type. | |
| const SocketAddress & | getLocalAddress () const throw () |
| Get the address of the local end of the socket. | |
| const SocketAddress & | getRemoteAddress () const throw () |
| Get the address of the remote (peer) end of the socket. | |
Static Public Attributes | |
| static uint8_t | TTL_HOST = 0 |
| A TTL value representing localhost scope. | |
| static uint8_t | TTL_SUBNET = 1 |
| A TTL value representing subnet scope. | |
| static uint8_t | TTL_SITE = 32 |
| A TTL value representing site-wide scope. | |
| static uint8_t | TTL_REGION = 64 |
| A TTL value representing regional scope. | |
| static uint8_t | TTL_CONTINENT = 128 |
| A TTL value representing continental scope. | |
| static uint8_t | TTL_UNRESTRICTED = 255 |
| A TTL value representing unlimited scope. | |
| static const size_t | MAX_DATAGRAM_SIZE = 16384 |
| The maximum size of a datagram packet. | |
Protected Types | |
| enum | IOWaitMode { WaitWrite, WaitRead } |
Protected Member Functions | |
| SocketHandle | getSocketHandle () const throw () |
| Get the underlying socket handle for this socket. | |
| void | waitForIO (IOWaitMode mode) throw (IOException) |
| Wait for the socket to become ready for reading or writing. | |
Protected Attributes | |
| NetProtocol | _type |
| The socket type. | |
| SocketHandle | _socket |
| A handle to the socket itself. | |
| SocketAddress | _raddr |
| The remote address. | |
| SocketAddress | _laddr |
| The local address. | |
| int | _sotimeout |
| The timeout value. | |
| bool | _connected |
| bool | _reuseAddr |
Multicast socket addresses range from 224.0.0.0 to 239.255.255.255, inclusive, with 224.0.0.0 reserved.
enum IOWaitMode [protected, inherited] |
| MulticastSocket | ( | uint16_t | port = 0 |
) | throw () |
Construct a new MulticastSocket bound to the given port.
| port | The port on which to listen. |
| ~MulticastSocket | ( | ) | throw () |
Destructor.
| void connect | ( | const SocketAddress & | addr | ) | throw (IOException) [virtual, inherited] |
Connect the datagram socket to a remote endpoint.
Connecting a datagram socket to an address does not actually establish a network connection, but rather restricts the socket so that it may only exchange datagrams with that address.
| addr | The address. |
| IOException | If an error occurs. |
Reimplemented from Socket.
| void connect | ( | const String & | addr, | |
| uint16_t | port | |||
| ) | throw (IOException) [virtual, inherited] |
Connect the datagram socket to a remote endpoint.
Connecting a datagram socket to an address does not actually establish a network connection, but rather restricts the socket so that it may only exchange datagrams with that address.
| addr | The address, which may either be a dot-separated IP address or a DNS name. | |
| port | The port number. |
| IOException | If an error occurs. |
Reimplemented from Socket.
| bool getBroadcast | ( | ) | const throw (SocketException) [inherited] |
Determine if broadcast is enabled.
| SocketException | If an error occurs. |
| bool getKeepAlive | ( | ) | throw (SocketException) [inherited] |
Determine if the SO_KEEPALIVE option is enabled or disabled.
| SocketException | If a socket error occurs. |
| int getLingerTime | ( | ) | const throw (SocketException) [inherited] |
Get the linger time for the socket.
| SocketException | If the linger time could not be retrieved. |
| const SocketAddress& getLocalAddress | ( | ) | const throw () [inline, inherited] |
Get the address of the local end of the socket.
| size_t getReceiveBufSize | ( | ) | const throw (SocketException) [inherited] |
Get the size of the socket's internal receive buffer.
| SocketException | If the size could not be changed. |
| const SocketAddress& getRemoteAddress | ( | ) | const throw () [inline, inherited] |
Get the address of the remote (peer) end of the socket.
| bool getReuseAddress | ( | ) | const throw (SocketException) [inherited] |
Determine if the SO_REUSEADDR option is enabled or disabled.
| SocketException | If a socket error occurs. |
| size_t getSendBufSize | ( | ) | const throw (SocketException) [inherited] |
Get the size of the socket's internal send buffer.
| SocketException | If the size could not be changed. |
| SocketHandle getSocketHandle | ( | ) | const throw () [inline, protected, inherited] |
Get the underlying socket handle for this socket.
| bool getTCPDelay | ( | ) | throw (SocketException) [inherited] |
Determine if the Nagle algorithm is enabled or disabled.
| SocketException | If a socket error occurs. |
| uint8_t getTTL | ( | ) | const throw (SocketException) |
| NetProtocol getType | ( | ) | const throw () [inline, inherited] |
Get the socket type.
| void init | ( | ) | throw (SocketException) [virtual, inherited] |
Initialize the socket.
This method creates the underlying socket object.
| SocketException | If the socket could not be created. |
Reimplemented in ServerSocket.
| bool isConnected | ( | ) | const throw () [inline, inherited] |
Determine if the socket is connected.
| bool isInitialized | ( | ) | const throw () [inline, inherited] |
Determine if the socket has been initialized.
| bool isLoopbackEnabled | ( | ) | const throw (SocketException) |
Determine if local loopback is enabled.
| SocketException | If the operation fails. |
| void join | ( | const InetAddress & | address, | |
| const NetworkInterface & | ixface | |||
| ) | throw (SocketException) |
Join a multicast group on a specific interface.
| address | The address to join. | |
| ixface | The network interface. |
| SocketException | If the operation fails. |
| void join | ( | const String & | address, | |
| const NetworkInterface & | ixface | |||
| ) | throw (SocketException) |
Join a multicast group on a specific interface.
| address | The address to join, as a dot-separated IP address. | |
| ixface | The network interface. |
| SocketException | If the operation fails. |
| void join | ( | const InetAddress & | address | ) | throw (SocketException) |
Join a multicast group.
| address | The address to join. |
| SocketException | If the operation fails. |
| void join | ( | const String & | address | ) | throw (SocketException) |
Join a multicast group.
| address | The address to join, as a dot-separated IP address. |
| SocketException | If the operation fails. |
| void leave | ( | const InetAddress & | address, | |
| const ccxx::NetworkInterface & | ixface | |||
| ) | throw (SocketException) |
Leave a multicast group on a specific interface.
| address | The address to leave. | |
| ixface | The network interface. |
| SocketException | If the operation fails. |
| void leave | ( | const String & | address, | |
| const ccxx::NetworkInterface & | ixface | |||
| ) | throw (SocketException) |
Leave a multicast group on a specific interface.
| address | The address to leave, as a dot-separated IP address. | |
| ixface | The network interface. |
| SocketException | If the operation fails. |
| void leave | ( | const InetAddress & | address | ) | throw (SocketException) |
Leave a multicast group.
| address | The address to leave. |
| SocketException | If the operation fails. |
| void leave | ( | const String & | address | ) | throw (SocketException) |
Leave a multicast group.
| address | The address to leave, as a dot-separated IP address. |
| SocketException | If the operation fails. |
| size_t receive | ( | ByteBuffer & | buffer, | |
| SocketAddress & | source | |||
| ) | throw (IOException) [inherited] |
Receive a datagram and write it to a buffer.
| buffer | The buffer to write the data to. | |
| source | The object in which to place the source address of the received datagram. |
| IOException | If an error occurs. |
| size_t receive | ( | byte_t * | buffer, | |
| size_t | buflen, | |||
| SocketAddress & | source | |||
| ) | throw (IOException) [inherited] |
Receive a datagram and write it to a buffer.
| buffer | The raw buffer to write the data to. | |
| buflen | The length of the buffer. | |
| source | The object in which to place the source address of the received datagram. |
| IOException | If an error occurs. |
| size_t receive | ( | ByteBuffer & | buffer | ) | throw (IOException) [inherited] |
Receive a datagram from the remote endpoint, and write it to a buffer.
The socket must be connected before this method can be used.
| buffer | The buffer to write the data to. |
| IOException | If an error occurs. |
| size_t receive | ( | byte_t * | buffer, | |
| size_t | buflen | |||
| ) | throw (IOException) [inherited] |
Receive a datagram from the remote endpoint, and write it to a buffer.
The socket must be connected before this method can be used.
| buffer | The raw buffer to write the data to. | |
| buflen | The length of the buffer. |
| IOException | If an error occurs. |
| size_t send | ( | ByteBuffer & | buffer, | |
| const SocketAddress & | dest | |||
| ) | throw (IOException) [inherited] |
Send a datagram to a given address.
| buffer | The buffer containing the data to send. | |
| dest | The destination address. |
| IOException | If an error occurs. |
| size_t send | ( | const byte_t * | buffer, | |
| size_t | buflen, | |||
| const SocketAddress & | dest | |||
| ) | throw (IOException) [inherited] |
Send a datagram to a given address.
| buffer | The raw buffer containing the data to send. | |
| buflen | The length of the buffer. | |
| dest | The destination address. |
| IOException | If an error occurs. |
| size_t send | ( | ByteBuffer & | buffer | ) | throw (IOException) [inherited] |
Send a datagram to the remote endpoint.
The socket must be connected before this method can be used.
| buffer | The buffer containing the data to send. |
| IOException | If an error occurs. |
| size_t send | ( | const byte_t * | buffer, | |
| size_t | buflen | |||
| ) | throw (IOException) [inherited] |
Send a datagram to the remote endpoint.
The socket must be connected before this method can be used.
| buffer | The raw buffer containing the data to send. | |
| buflen | The length of the buffer. |
| IOException | If an error occurs. |
| void setBroadcast | ( | bool | flag | ) | throw (SocketException) [inherited] |
Enable or disable broadcast.
When enabled, the socket will receive packets sent to a broadcast address and is allowed to send packets to a broadcast address.
| flag | A flag indicating whether the feature should be enabled or disabled. |
| SocketException | If an error occurs. |
| void setKeepAlive | ( | bool | enable | ) | throw (SocketException) [inherited] |
Enable or disable the SO_KEEPALIVE option on the socket.
| enable | true to enable the option false to disable it. |
| SocketException | If a socket error occurs. |
| void setLingerTime | ( | int | msec | ) | throw (SocketException) [inherited] |
Set the linger time for the socket.
| msec | The new linger time, in milliseconds; a negative value disables the linger feature. |
| SocketException | If the linger time could not be changed. |
| void setLoopbackEnabled | ( | bool | enabled | ) | throw (SocketException) |
Enable or disable local loopback of multicast datagrams.
When the loopback is enabled, the sender receives copies of all multicast datagrams that it sends.
| enabled | true if loopback should be enabled, false if it should be disabled. |
| SocketException | If the operation fails. |
| void setReceiveBufSize | ( | size_t | size | ) | throw (SocketException) [inherited] |
Set the size of the socket's internal receive buffer.
| size | The new size, in bytes. |
| SocketException | If the size could not be changed. |
| void setReuseAddress | ( | bool | enable | ) | throw (SocketException) [inherited] |
Enable or disable the SO_REUSEADDR option on the socket.
This method may only be called before the socket has been initialized. This option is off by default in newly created sockets.
| enable | true to enable the option false to disable it. |
| SocketException | If a socket error occurs, or if the call was made after the socket was initialized. |
| void setSendBufSize | ( | size_t | size | ) | throw (SocketException) [inherited] |
Set the size of the socket's internal send buffer.
| size | The new size, in bytes. |
| SocketException | If the size could not be changed. |
| void setTCPDelay | ( | bool | enable | ) | throw (SocketException) [inherited] |
Enable or disable the Nagle algorithm for send coalescing.
| enable | true to enable the Nagle algorithm (TCP_NODELAY off), false to disable it (TCP_NODELAY on). |
| SocketException | If a socket error occurs. |
| void setTimeout | ( | int | msec | ) | throw (SocketException) [inherited] |
Set the timeout for the socket.
The timeout affects both I/O and connections.
| msec | The timeout, in milliseconds. |
| SocketException | If an error occurs. |
Reimplemented in StreamSocket.
| void setTTL | ( | uint8_t | ttl | ) | throw (SocketException) |
Set the TTL (time-to-live) value for outgoing multicast datagrams.
The TTL is the number of "hops" that a packet is allowed to make on the network before being discarded.
| ttl | The new TTL value. |
| SocketException | If the operation fails. |
| void shutdown | ( | ) | throw () [virtual, inherited] |
Shut down the socket.
Closes the connection and destroys the underlying socket object.
Reimplemented in ServerSocket, and StreamSocket.
| void waitForIO | ( | IOWaitMode | mode | ) | throw (IOException) [protected, inherited] |
Wait for the socket to become ready for reading or writing.
| mode | The wait mode; one of WaitWrite or WaitRead. |
| IOException | On timeout or other error. |
bool _connected [protected, inherited] |
SocketAddress _laddr [protected, inherited] |
The local address.
SocketAddress _raddr [protected, inherited] |
The remote address.
bool _reuseAddr [protected, inherited] |
SocketHandle _socket [protected, inherited] |
A handle to the socket itself.
int _sotimeout [protected, inherited] |
The timeout value.
NetProtocol _type [protected, inherited] |
The socket type.
const size_t MAX_DATAGRAM_SIZE = 16384 [static, inherited] |
The maximum size of a datagram packet.
uint8_t TTL_CONTINENT = 128 [static] |
A TTL value representing continental scope.
uint8_t TTL_HOST = 0 [static] |
A TTL value representing localhost scope.
uint8_t TTL_REGION = 64 [static] |
A TTL value representing regional scope.
uint8_t TTL_SITE = 32 [static] |
A TTL value representing site-wide scope.
uint8_t TTL_SUBNET = 1 [static] |
A TTL value representing subnet scope.
uint8_t TTL_UNRESTRICTED = 255 [static] |
A TTL value representing unlimited scope.
1.5.9