TCP/IP socket connection. More...

#include <tcp_connection.h>

+ Inheritance diagram for clan::TCPConnection:

Public Member Functions

 TCPConnection ()
 Create null object. More...
 TCPConnection (const SocketName &endpoint)
 Blocking connect to end point. More...
 TCPConnection (const std::shared_ptr< TCPSocket > &impl)
 ~TCPConnection ()
void close ()
 Close connection. More...
SocketName get_local_name ()
 Returns the socket name of the local end point. More...
SocketName get_remote_name ()
 Returns the socket name of the peer end point. More...
bool is_null () const
 Returns true if it is a null object. More...
int read (void *data, int size)
 Read data from TCP socket. More...
int write (const void *data, int size)
 Write data to TCP socket. More...

Static Public Member Functions

static void init_sockets ()

Protected Member Functions

SocketHandle * get_socket_handle () override

Detailed Description

TCP/IP socket connection.

Constructor & Destructor Documentation

clan::TCPConnection::TCPConnection ( )

Create null object.

clan::TCPConnection::TCPConnection ( const SocketName endpoint)

Blocking connect to end point.

clan::TCPConnection::~TCPConnection ( )
clan::TCPConnection::TCPConnection ( const std::shared_ptr< TCPSocket > &  impl)

Member Function Documentation

void clan::TCPConnection::close ( )

Close connection.

SocketName clan::TCPConnection::get_local_name ( )

Returns the socket name of the local end point.

SocketName clan::TCPConnection::get_remote_name ( )

Returns the socket name of the peer end point.

SocketHandle* clan::TCPConnection::get_socket_handle ( )

Implements clan::NetworkEvent.

static void clan::TCPConnection::init_sockets ( )
bool clan::TCPConnection::is_null ( ) const

Returns true if it is a null object.

int clan::TCPConnection::read ( void *  data,
int  size 

Read data from TCP socket.

Bytes read, 0 if remote closed connection, or -1 if buffer is empty
int clan::TCPConnection::write ( const void *  data,
int  size 

Write data to TCP socket.

Bytes written, or -1 if buffer is full

The documentation for this class was generated from the following file: