class UDPTransmit

Unreliable Datagram Peer Associations. More...

Definition#include <socket.h>
InheritsUDPSocket [private]
Inherited byUDPDuplex
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members


Detailed Description

Representing half of a two-way UDP connection, the UDP transmitter can broadcast data to another selected peer host or to an entire subnet.

UDPTransmit (const InetAddress &bind, tpport_t port, tpport_t peer = 0)
[protected]

Create a UDP transmitter, bind it to a specific interface and port address so that other UDP sockets on remote machines (or the same host) may find and send UDP messages to it, and associate it with a given port on a peer host. On failure to bind, an exception is thrown. This class is only used to build the UDP Duplex.

Parameters:
bindaddress to bind this socket to.
portnumber to bind this socket to.
portnumber on peer host to associate with.

sockerror_t Connect (const InetHostAddress &host)

Associate this socket with a specified peer host. The port number from the constructor will be used. All UDP packets will be sent to and received from the specified host.

Parameters:
hostaddress to connect socket to.

Returns: 0 on success, -1 on error.

sockerror_t Connect (const BroadcastAddress &subnet)

Associate this socket with a subnet of peer hosts for subnet broadcasting. The server must be able to assert broadcast permission for the socket.

Parameters:
subnetaddress to broadcast into.

Returns: 0 on success, -1 on error.

sockerror_t Disconnect (void)

Disassociate this socket from any host connection. No data should be read or written until a connection is established.

inline int Send (void *buf, int len)

Transmit "send" to use "connected" send rather than sendto.

Parameters:
addressof buffer to send.
lenof bytes to send.

Returns: number of bytes sent.

Reimplemented from UDPSocket

inline bool isOutputReady (timeout_t timeout = TIMEOUT_INF)

See if output queue is empty for sending more packets.

Parameters:
timeoutin milliseconds to wait.

Returns: true if output available.