GNU CommonC++
Public Member Functions | List of all members
ost::UDPDuplex Class Reference

UDP duplex connections impliment a bi-directional point-to-point UDP session between two peer hosts. More...

#include <socket.h>

Inheritance diagram for ost::UDPDuplex:
ost::UDPTransmit ost::UDPReceive ost::UDPSocket ost::UDPSocket ost::Socket ost::Socket

Public Member Functions

 UDPDuplex (const IPV4Address &bind, tpport_t port)
 Create a UDP duplex as a pair of UDP simplex objects bound to alternating and interconnected port addresses.
 UDPDuplex (const IPV6Address &bind, tpport_t port)
Error connect (const IPV4Host &host, tpport_t port)
 Associate the duplex with a specified peer host.
Error connect (const IPV6Host &host, tpport_t port)
Error disconnect (void)
 Disassociate this duplex from any host connection.
- Public Member Functions inherited from ost::UDPTransmit
ssize_t transmit (const char *buffer, size_t len)
 Transmit "send" to use "connected" send rather than sendto.
bool isOutputReady (unsigned long timeout=0l)
 See if output queue is empty for sending more packets.
Error setRouting (bool enable)
Error setTypeOfService (Tos tos)
Error setBroadcast (bool enable)
- Public Member Functions inherited from ost::UDPReceive
ssize_t receive (void *buf, size_t len)
 Receive a data packet from the connected peer host.
bool isInputReady (timeout_t timeout=TIMEOUT_INF)
 See if input queue has data packets available.

Additional Inherited Members

- Protected Types inherited from ost::Socket
enum  Family { IPV6 = AF_INET6, IPV4 = AF_INET }
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
}
enum  Tos {
  tosLowDelay = 0, tosThroughput, tosReliability, tosMinCost,
  tosInvalid
}
enum  Pending { pendingInput, pendingOutput, pendingError }
typedef enum Family Family
typedef enum Error Error
typedef enum Tos Tos
typedef enum Pending Pending
- Protected Member Functions inherited from ost::UDPTransmit
 UDPTransmit (Family family=IPV4)
 Create a UDP transmitter.
 UDPTransmit (const 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 (const IPV6Address &bind, tpport_t port=5005)
Error connect (const IPV6Address &host, tpport_t port)
Error connect (const IPV4Broadcast &subnet, tpport_t port)
 Associate this socket with a subnet of peer hosts for subnet broadcasting.
Error connect (const IPV4Multicast &mgroup, tpport_t port)
 Associate this socket with a multicast group.
Error connect (const IPV6Multicast &mgroup, tpport_t port)
ssize_t send (const void *buf, size_t len)
 Transmit "send" to use "connected" send rather than sendto.
void endTransmitter (void)
 Stop transmitter.
SOCKET getTransmitter (void)
Error setMulticast (bool enable)
Error setTimeToLive (unsigned char ttl)
- Protected Member Functions inherited from ost::UDPReceive
 UDPReceive (const 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 (const IPV6Address &bind, tpport_t port)
bool isPendingReceive (timeout_t timeout)
 Check for pending data.
void endReceiver (void)
 End receiver.
SOCKET getReceiver (void) const
Error setRouting (bool enable)
Error setMulticast (bool enable)
Error join (const IPV4Multicast &ia)
Error join (const IPV6Multicast &ia)
Error drop (const IPV4Multicast &ia)
Error drop (const IPV6Multicast &ia)
- Static Protected Member Functions inherited from ost::Socket
static bool check (Family fam)
 See if a specific protocol family is available in the current runtime environment.
union {
   struct sockaddr_in6   ipv6
   struct sockaddr_in   ipv4
peer
Family family

Detailed Description

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.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Unreliable Datagram Peer Associations.

Constructor & Destructor Documentation

ost::UDPDuplex::UDPDuplex ( const IPV4Address bind,
tpport_t  port 
)

Create a UDP duplex as a pair of UDP simplex objects bound to alternating and interconnected port addresses.

Parameters
bindaddress to bind this socket to.
portnumber to bind sender.
ost::UDPDuplex::UDPDuplex ( const IPV6Address bind,
tpport_t  port 
)

Member Function Documentation

Error ost::UDPDuplex::connect ( const 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.

Returns
0 on success, error code on error.
Parameters
hostaddress to connect socket to.
portnumber to connect socket to.

Reimplemented from ost::UDPTransmit.

Error ost::UDPDuplex::connect ( const IPV6Host host,
tpport_t  port 
)

Reimplemented from ost::UDPReceive.

Error ost::UDPDuplex::disconnect ( void  )

Disassociate this duplex from any host connection.

No data should be read or written until a connection is established.

Returns
0 on success, error code on error.

Reimplemented from ost::UDPSocket.


The documentation for this class was generated from the following file: