Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
clan::TCPConnection Class Reference

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 | ( |  | ) |
| override protected virtual

Implements clan::NetworkEvent.

static void clan::TCPConnection::init_sockets | ( |  | ) |
| static

bool clan::TCPConnection::is_null | ( |  | ) | const
| inline

Returns true if it is a null object.

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

Read data from TCP socket.

Returns
  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.

Returns
  Bytes written, or -1 if buffer is full

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

- tcp_connection.h