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

A bidirectional TCP connection (either a client connection or returned by ATcpServerSocket). More...

Detailed Description

A bidirectional TCP connection (either a client connection or returned by ATcpServerSocket).

Public Member Functions

 ATcpSocket (const AInet4Address &destinationAddress)
 
size_t read (char *dst, size_t size) override
 Reads up to size bytes from stream. Blocking (waiting for new data) is allowed. More...
 
void write (const char *buffer, size_t size) override
 Writes exact size bytes to stream. Blocking (waiting for write all data) is allowed. More...
 
- Public Member Functions inherited from AAbstractSocket
 AAbstractSocket (const AAbstractSocket &)=delete
 
void close ()
 
void setTimeout (int secs)
 
const AInet4AddressgetAddress () const
 
- Public Member Functions inherited from IInputStream
size_t read (std::span< std::byte > destination)
 Reads up to destination.size() bytes from stream. Blocking (waiting for new data) is allowed. More...
 
void readExact (char *dst, size_t size)
 Reads exact size bytes from stream. Blocking (waiting for new data) is allowed. More...
 
template<typename T >
deserialize ()
 
template<typename T >
IInputStreamoperator>> (T &dst)
 
template<typename T >
IInputStreamoperator>> (T &&dst)
 
- Public Member Functions inherited from IOutputStream
template<typename T >
void write (const T &t)
 
template<typename T >
IOutputStreamoperator<< (const T &t)
 

Protected Member Functions

 ATcpSocket (int handle, const AInet4Address &selfAddr)
 
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...
 

Friends

class ATcpServerSocket
 

Additional Inherited Members

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

Member Function Documentation

◆ createSocket()

int ATcpSocket::createSocket ( )
overrideprotectedvirtual

Create socket handle. Use ::socket()

Implements AAbstractSocket.

◆ read()

size_t ATcpSocket::read ( char *  dst,
size_t  size 
)
overridevirtual

Reads up to size bytes from stream. Blocking (waiting for new data) is allowed.

Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
dstdestination buffer
sizedestination buffer's size. > 0
Returns
number of read bytes (including 0)

Implements IInputStream.

◆ write()

void ATcpSocket::write ( const char *  src,
size_t  size 
)
overridevirtual

Writes exact size bytes to stream. Blocking (waiting for write all data) is allowed.

Sneaky exceptions
An implementation can throw any exception that subclasses AIOException.
Parameters
dstsource buffer
sizesource buffer's size. > 0

Implements IOutputStream.

#include <AUI/Network/ATcpSocket.h>


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