Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | Examples

Async::TcpConnection Class Reference

A class for handling exiting TCP connections. More...

#include <AsyncTcpConnection.h>

Inheritance diagram for Async::TcpConnection:

Async::TcpClient List of all members.

Public Types

Public Member Functions

Public Attributes

Static Public Attributes

Protected Member Functions


Detailed Description

A class for handling exiting TCP connections.

Author:
Tobias Blomberg
Date:
2003-12-07
This class is used to handle an existing TCP connection. It is not meant to be used directly but could be. It it mainly created to handle connections for Async::TcpClient and Async::TcpServer.

Definition at line 122 of file AsyncTcpConnection.h.


Member Enumeration Documentation

enum Async::TcpConnection::DisconnectReason
 

Reason code for disconnects.

Enumerator:
DR_HOST_NOT_FOUND  The specified host was not found in the DNS.
DR_REMOTE_DISCONNECTED  The remote host disconnected.
DR_SYSTEM_ERROR  A system error occured (check errno).
DR_RECV_BUFFER_OVERFLOW  Receiver buffer overflow.

Definition at line 128 of file AsyncTcpConnection.h.


Constructor & Destructor Documentation

Async::TcpConnection::TcpConnection size_t  recv_buf_len = DEFAULT_RECV_BUF_LEN  )  [explicit]
 

Constructor.

Parameters:
recv_buf_len The length of the receiver buffer to use

Async::TcpConnection::TcpConnection int  sock,
const IpAddress remote_addr,
unsigned short  remote_port,
size_t  recv_buf_len = DEFAULT_RECV_BUF_LEN
 

Constructor.

Parameters:
sock The socket for the connection to handle
remote_addr The remote IP-address of the connection
remote_port The remote TCP-port of the connection
recv_buf_len The length of the receiver buffer to use

Async::TcpConnection::~TcpConnection void   ) 
 

Destructor.


Member Function Documentation

void Async::TcpConnection::disconnect void   ) 
 

Disconnect from the remote host.

Call this function to disconnect from the remote host. If already disconnected, nothing will be done. The disconnected signal is not emitted when this function is called

Reimplemented in Async::TcpClient.

const IpAddress& Async::TcpConnection::remoteHost void   )  const [inline]
 

Return the IP-address of the remote host.

Returns:
Returns the IP-address of the remote host
This function returns the IP-address of the remote host.

Definition at line 186 of file AsyncTcpConnection.h.

unsigned short Async::TcpConnection::remotePort void   )  const [inline]
 

Return the remote port used.

Returns:
Returns the remote port

Definition at line 192 of file AsyncTcpConnection.h.

void Async::TcpConnection::setRemoteAddr const IpAddress remote_addr  )  [protected]
 

Setup information about the connection.

Parameters:
remote_addr The remote IP-address of the connection
Use this function to set up the remote IP-address for the connection.

void Async::TcpConnection::setRemotePort unsigned short  remote_port  )  [protected]
 

Setup information about the connection.

Parameters:
remote_port The remote TCP-port of the connection
Use this function to set up the remote port for the connection.

void Async::TcpConnection::setSocket int  sock  )  [protected]
 

Setup information about the connection.

Parameters:
sock The socket for the connection to handle
Use this function to set up the socket for the connection.

int Async::TcpConnection::socket void   )  const [inline, protected]
 

Return the socket file descriptor.

Returns:
Returns the currently used socket file descriptor
Use this function to get the socket file descriptor that is currently in use. If it is -1 it has not been set.

Definition at line 257 of file AsyncTcpConnection.h.

int Async::TcpConnection::write const void *  buf,
int  count
 

Write data to the TCP connection.

Parameters:
buf The buffer containing the data to send
count The number of bytes to send from the buffer
Returns:
Returns the number of bytes written or -1 on failure


Member Data Documentation

SigC::Signal3<int, TcpConnection *, void *, int> Async::TcpConnection::dataReceived
 

A signal that is emitted when data has been received on the connection.

Parameters:
buf A buffer containg the read data
count The number of bytes in the buffer
Returns:
Return the number of processed bytes
This signal is emitted when data has been received on this connection. The buffer will contain the bytes read from the operating system. The slot must return the number of bytes that has been processed. The bytes not processed will be stored in the receive buffer for this class and presented again to the slot when more data arrives. The new data will be appended to the old data.

Definition at line 215 of file AsyncTcpConnection.h.

const int Async::TcpConnection::DEFAULT_RECV_BUF_LEN = 1024 [static]
 

The default length of the reception buffer.

Definition at line 139 of file AsyncTcpConnection.h.

SigC::Signal2<void, TcpConnection *, DisconnectReason> Async::TcpConnection::disconnected
 

A signal that is emitted when a connection has been terminated.

Parameters:
con The connection object
reason The reason for the disconnect

Definition at line 199 of file AsyncTcpConnection.h.

SigC::Signal1<void, bool> Async::TcpConnection::sendBufferFull
 

A signal that is emitted when the send buffer status changes.

Parameters:
is_full Set to true if the buffer is full or false if a buffer full condition has been cleared

Definition at line 222 of file AsyncTcpConnection.h.


The documentation for this class was generated from the following file:
Generated on Thu Dec 1 22:30:33 2005 for Async by  doxygen 1.4.4