AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AUdpSocket Class Reference

A bidirectional UDP socket. More...

Detailed Description

A bidirectional UDP socket.

Public Member Functions

 AUdpSocket (uint16_t port)
 Creates socket. More...
 
 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. More...
 
void read (AByteBuffer &buf, AInet4Address &dst)
 Read data. More...
 
- 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
 Create socket handle. Use ::socket() More...
 
- Protected Member Functions inherited from AAbstractSocket
int getHandle () const
 
 AAbstractSocket (int handle, const AInet4Address &selfAddress)
 
void init ()
 Initialise socket.
 
void bind (uint16_t bindingPort)
 Bind socket for port. Used for ATcpServerSocket and AUdpSocket. More...
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ AUdpSocket()

AUdpSocket::AUdpSocket ( uint16_t  port)

Creates socket.

Parameters
portport

Member Function Documentation

◆ createSocket()

int AUdpSocket::createSocket ( )
overrideprotectedvirtual

Create socket handle. Use ::socket()

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

#include <AUI/Network/AUdpSocket.h>


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