DUNE: Uniform Navigational Environment
2019.02.1
|
UDP Socket.
Public Member Functions | |
UDPSocket (void) | |
~UDPSocket (void) | |
void | enableBroadcast (bool value) |
void | setMulticastTTL (uint8_t ttl=1) |
void | setMulticastLoop (bool loopback=true) |
void | joinMulticastGroup (Address group, Address itf=Address::Any) |
void | bind (uint16_t port=0, Address add=Address::Any, bool reuse=true) |
void | connect (const Address &addr, uint16_t port) |
size_t | write (const uint8_t *buffer, size_t size, const Address &addr, uint16_t port) |
size_t | read (uint8_t *buffer, size_t size, Address *addr=NULL, uint16_t *port=NULL) |
Public Member Functions inherited from DUNE::IO::Handle | |
virtual | ~Handle (void) |
size_t | write (const uint8_t *data, size_t length) |
size_t | write (const char *data, size_t length) |
size_t | writeString (const char *cstr) |
size_t | read (uint8_t *data, size_t length) |
size_t | read (char *data, size_t length) |
size_t | readString (char *bfr, size_t length) |
void | flush (void) |
void | flushInput (void) |
void | flushOutput (void) |
NativeHandle | getNative (void) const |
Additional Inherited Members | |
Protected Member Functions inherited from DUNE::IO::Handle | |
virtual void | doFlushInput (void) |
virtual void | doFlushOutput (void) |
virtual void | doFlush (void) |
DUNE::Network::UDPSocket::UDPSocket | ( | void | ) |
DUNE::Network::UDPSocket::~UDPSocket | ( | void | ) |
Destroy an UDP socket.
void DUNE::Network::UDPSocket::bind | ( | uint16_t | port = 0 , |
Address | add = Address::Any , |
||
bool | reuse = true |
||
) |
Assign a name to a socket.
References DUNE::Utils::ByteCopy::toBE(), and DUNE::Network::Address::toInteger().
|
inline |
References read(), UDPSocket(), and write().
void DUNE::Network::UDPSocket::enableBroadcast | ( | bool | value | ) |
void DUNE::Network::UDPSocket::joinMulticastGroup | ( | Address | group, |
Address | itf = Address::Any |
||
) |
References DUNE::Network::Address::toInteger().
size_t DUNE::Network::UDPSocket::read | ( | uint8_t * | buffer, |
size_t | size, | ||
Address * | addr = NULL , |
||
uint16_t * | port = NULL |
||
) |
Receive an UDP datagram, retrieving the address of the source host.
buffer | destination buffer. |
size | destination buffer length. |
addr | system specific host address. |
port | system specific host port. |
References DUNE::Utils::ByteCopy::fromBE().
Referenced by connect().
void DUNE::Network::UDPSocket::setMulticastLoop | ( | bool | loopback = true | ) |
void DUNE::Network::UDPSocket::setMulticastTTL | ( | uint8_t | ttl = 1 | ) |
size_t DUNE::Network::UDPSocket::write | ( | const uint8_t * | buffer, |
size_t | size, | ||
const Address & | addr, | ||
uint16_t | port | ||
) |
Send an UDP datagram to a host.
buffer | buffer to send. |
size | buffer length. |
addr | system specific host address. |
port | destination port. |
References DUNE::Network::Address::str(), DUNE::Utils::ByteCopy::toBE(), and DUNE::Network::Address::toInteger().
Referenced by connect().