public

Inheritance Graph

graph BT
	TCPConnection
	TCPConnection --> ReferenceCounter
	click TCPConnection "classUtil_1_1Network_1_1TCPConnection"
	click ReferenceCounter "classUtil_1_1ReferenceCounter"

Description

TCP Connection between two endpoints.

State

   
   
bool isOpen() const
   
bool isClosed() const
   
void close()

Data handling

   
   
bool sendData(const std::vector< uint8_t > & data)
   
bool sendString(const std::string & s)
   
std::vector< uint8_t > receiveData()
   
std::vector< uint8_t > receiveData(size_t numBytes)
   
std::string receiveString(char delimiter)
   
size_t getAvailableDataSize() const

Public Static Functions

   
   
Reference < TCPConnection > connect(const IPv4Address & remote)

Public Functions

   
   
  ~TCPConnection()
   
float getLastActiveTime() const
   
IPv4Address getRemoteIp() const

Documentation

function
Util::Network::TCPConnection::isOpen

public const inline
   
   
bool isOpen( ) const

Defined in Util/Network/NetworkTCP.h:60


function
Util::Network::TCPConnection::isClosed

public const inline
   
   
bool isClosed( ) const

Defined in Util/Network/NetworkTCP.h:61


function
Util::Network::TCPConnection::close

public
   
   
void close( )

Defined in Util/Network/NetworkTCP.h:62


function
Util::Network::TCPConnection::sendData

public
     
     
bool sendData( const std::vector< uint8_t > & data )

Defined in Util/Network/NetworkTCP.h:79


function
Util::Network::TCPConnection::sendString

public
     
     
bool sendString( const std::string & s )

Note: The string should end with a termination symbol, e.g. 0 Otherwise it can’t be extracted properly.

Defined in Util/Network/NetworkTCP.h:82


function
Util::Network::TCPConnection::receiveData

public
   
   
std::vector< uint8_t > receiveData( )

Returns all received data as a std::vector Object or nullptr if nothing was received.

Defined in Util/Network/NetworkTCP.h:86


function
Util::Network::TCPConnection::receiveData

public
     
     
std::vector< uint8_t > receiveData( size_t numBytes )

Returns numBytes many bytes of received data as std::vector Object or an empty array if less data was received.

Defined in Util/Network/NetworkTCP.h:90


function
Util::Network::TCPConnection::receiveString

public
     
     
std::string receiveString( char delimiter )

Returns a string ending withdelimiteror “” if no delimiter is found.

Defined in Util/Network/NetworkTCP.h:93


function
Util::Network::TCPConnection::getAvailableDataSize

public const inline
   
   
size_t getAvailableDataSize( ) const

Returns the number of bytes in the input buffer

Defined in Util/Network/NetworkTCP.h:96


function
Util::Network::TCPConnection::connect

public static
     
     
Reference < TCPConnection > connect( const IPv4Address & remote )

Tries to open a connection to a TCP-Server at given address.

Returns

TCPConnection if successful, throws a runtime_error on failure

Defined in Util/Network/NetworkTCP.h:45


function
Util::Network::TCPConnection::~TCPConnection

public virtual
   
   
~TCPConnection( )

Defined in Util/Network/NetworkTCP.h:47


function
Util::Network::TCPConnection::getLastActiveTime

public const inline
   
   
float getLastActiveTime( ) const

Defined in Util/Network/NetworkTCP.h:49


function
Util::Network::TCPConnection::getRemoteIp

public const
   
   
IPv4Address getRemoteIp( ) const

Defined in Util/Network/NetworkTCP.h:50