|
|
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 (InetAddress &bind, short port, short peer = 0) |
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:
bind | address to bind this socket to. |
port | number to bind this socket to. |
port | number on peer host to associate with. |
sockerror_t Connect (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:
host | address to connect socket to. |
Returns: 0 on success, -1 on error.
sockerror_t Connect (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:
subnet | address 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:
address | of buffer to send. |
len | of bytes to send. |
Returns: number of bytes sent.
Reimplemented from UDPSocket
inline bool isOutputReady (timeout_t timeout = ~0) |
See if output queue is empty for sending more packets.
Parameters:
timeout | in milliseconds to wait. |
Returns: true if output available.