AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AUdpSocket Class Reference

A bidirectional UDP socket. More...

#include <AUI/Network/AUdpSocket.h>

Public Member Functions

 AUdpSocket (uint16_t port)
 Creates socket.
 
 AUdpSocket ()
 Creates socket with random port (used for "client" socket)
 
 AUdpSocket (const AUdpSocket &)=delete
 
void write (AByteBufferView buf, const AInet4Address &dst)
 Sends data by address.
 
void read (AByteBuffer &buf, AInet4Address &dst)
 Read data.
 
- Public Member Functions inherited from AAbstractSocket
 AAbstractSocket (const AAbstractSocket &)=delete
 
void close ()
 
void setTimeout (int secs)
 
const AInet4AddressgetAddress () const
 

Protected Member Functions

int createSocket () override
 Creates socket handle.
 
- Protected Member Functions inherited from AAbstractSocket
int getHandle () const
 
 AAbstractSocket (int handle, const AInet4Address &selfAddress)
 
void init ()
 Initialise socket.
 
void bind (uint16_t bindingPort)
 Binds socket for port. Used for ATcpServerSocket and AUdpSocket.
 

Additional Inherited Members

- Static Protected Member Functions inherited from AAbstractSocket
static AString getErrorString ()
 
static void handleError (const AString &message, int code)
 

Detailed Description

A bidirectional UDP socket.

Constructor & Destructor Documentation

◆ AUdpSocket()

AUdpSocket::AUdpSocket ( uint16_t port)

Creates socket.

Parameters
portport

Member Function Documentation

◆ createSocket()

int AUdpSocket::createSocket ( )
overrideprotectedvirtual

Creates socket handle.

Implements AAbstractSocket.

◆ read()

void AUdpSocket::read ( AByteBuffer & buf,
AInet4Address & dst )

Read data.

Parameters
buf(out) received data
dst(out) sender address

◆ write()

void AUdpSocket::write ( AByteBufferView buf,
const AInet4Address & dst )

Sends data by address.

Parameters
bufdata buffer
dstdestination delivery address

The documentation for this class was generated from the following files:
Inheritance diagram for AUdpSocket:
Collaboration diagram for AUdpSocket: