ucommon
|
UDP duplex connections impliment a bi-directional point-to-point UDP session between two peer hosts. More...
#include <udp.h>
Public Member Functions | |
Error | connect (IPV4Host &host, tpport_t port) |
Associate the duplex with a specified peer host. | |
Error | connect (IPV6Host &host, tpport_t port) |
Error | disconnect (void) |
Disassociate this duplex from any host connection. | |
UDPDuplex (IPV4Address &bind, tpport_t port) | |
Create a UDP duplex as a pair of UDP simplex objects bound to alternating and interconnected port addresses. | |
UDPDuplex (IPV6Address &bind, tpport_t port) | |
![]() | |
bool | isOutputReady (unsigned long timeout=0l) |
See if output queue is empty for sending more packets. | |
Error | setBroadcast (bool enable) |
Error | setRouting (bool enable) |
Error | setTypeOfService (Tos tos) |
ssize_t | transmit (char *buffer, size_t len) |
Transmit "send" to use "connected" send rather than sendto. | |
![]() | |
bool | isInputReady (timeout_t timeout=ucommon::Timer::inf) |
See if input queue has data packets available. | |
ssize_t | receive (void *buf, size_t len) |
Receive a data packet from the connected peer host. |
Additional Inherited Members | |
![]() | |
enum | Error { errSuccess = 0, errCreateFailed, errCopyFailed, errInput, errInputInterrupt, errResourceFailure, errOutput, errOutputInterrupt, errNotConnected, errConnectRefused, errConnectRejected, errConnectTimeout, errConnectFailed, errConnectInvalid, errConnectBusy, errConnectNoRoute, errBindingFailed, errBroadcastDenied, errRoutingDenied, errKeepaliveDenied, errServiceDenied, errServiceUnavailable, errMulticastDisabled, errTimeout, errNoDelay, errExtended, errLookupFail, errSearchErr, errInvalidValue } |
typedef enum Error | Error |
enum | Family { IPV6 = 1, IPV4 = 2 } |
typedef enum Family | Family |
enum | Pending { pendingInput, pendingOutput, pendingError } |
typedef enum Pending | Pending |
enum | State { INITIAL, AVAILABLE, BOUND, CONNECTED, CONNECTING, STREAM } |
typedef enum State | State |
enum | Tos { tosLowDelay = 0, tosThroughput, tosReliability, tosMinCost, tosInvalid } |
typedef enum Tos | Tos |
![]() | |
Error | connect (IPV6Address &host, tpport_t port) |
Error | connect (IPV4Broadcast &subnet, tpport_t port) |
Associate this socket with a subnet of peer hosts for subnet broadcasting. | |
Error | connect (IPV4Multicast &mgroup, tpport_t port) |
Associate this socket with a multicast group. | |
Error | connect (IPV6Multicast &mgroup, tpport_t port) |
void | endTransmitter (void) |
Stop transmitter. | |
SOCKET | getTransmitter (void) |
ssize_t | send (void *buf, size_t len) |
Transmit "send" to use "connected" send rather than sendto. | |
Error | setMulticast (bool enable) |
Set the multicast. | |
Error | setTimeToLive (unsigned char ttl) |
UDPTransmit (Family family=IPV4) | |
Create a UDP transmitter. | |
UDPTransmit (IPV4Address &bind, tpport_t port=5005) | |
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. | |
UDPTransmit (IPV6Address &bind, tpport_t port=5005) | |
![]() | |
Error | drop (IPV4Multicast &ia) |
Error | drop (IPV6Multicast &ia) |
void | endReceiver (void) |
End receiver. | |
SOCKET | getReceiver (void) |
bool | isPendingReceive (timeout_t timeout) |
Check for pending data. | |
Error | join (IPV4Multicast &ia) |
Error | join (IPV6Multicast &ia) |
Error | setMulticast (bool enable) |
Set the multicast. | |
Error | setRouting (bool enable) |
UDPReceive (IPV4Address &bind, tpport_t port) | |
Create a UDP receiver, 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. | |
UDPReceive (IPV6Address &bind, tpport_t port) | |
![]() | |
static bool | check (Family fam) |
See if a specific protocol family is available in the current runtime environment. | |
Family | family |
union { | |
struct sockaddr_in ipv4 | |
struct sockaddr_in6 ipv6 | |
} | peer |
UDP duplex connections impliment a bi-directional point-to-point UDP session between two peer hosts.
Two UDP sockets are typically used on alternating port addresses to assure that sender and receiver data does not collide or echo back. A UDP Duplex is commonly used for full duplex real-time streaming of UDP data between hosts.
ost::UDPDuplex::UDPDuplex | ( | IPV4Address & | bind, |
tpport_t | port | ||
) |
Create a UDP duplex as a pair of UDP simplex objects bound to alternating and interconnected port addresses.
bind | address to bind this socket to. |
port | number to bind sender. |
Error ost::UDPDuplex::connect | ( | IPV4Host & | host, |
tpport_t | port | ||
) |
Associate the duplex with a specified peer host.
Both the sender and receiver will be interconnected with the remote host.
host | address to connect socket to. |
port | number to connect socket to. |
Reimplemented from ost::UDPTransmit.
Error ost::UDPDuplex::disconnect | ( | void | ) |
Disassociate this duplex from any host connection.
No data should be read or written until a connection is established.
Reimplemented from ost::UDPSocket.