Async  1.5.0
Public Member Functions | Public Attributes | List of all members
Async::TcpClientBase Class Reference

A base class for creating a TCP client connection. More...

#include <AsyncTcpClientBase.h>

Inheritance diagram for Async::TcpClientBase:
Async::TcpClient< ConT >

Public Member Functions

 TcpClientBase (TcpConnection *con)
 Constructor. More...
 
 TcpClientBase (TcpConnection *con, const std::string &remote_host, uint16_t remote_port)
 Constructor. More...
 
 TcpClientBase (TcpConnection *con, const IpAddress &remote_ip, uint16_t remote_port)
 Constructor. More...
 
 ~TcpClientBase (void)
 Destructor. More...
 
void bind (const IpAddress &bind_ip)
 Bind to the interface having the specified IP address. More...
 
void connect (const std::string &remote_host, uint16_t remote_port)
 Connect to the remote host. More...
 
void connect (const Async::IpAddress &remote_ip, uint16_t remote_port)
 Connect to the remote host. More...
 
void connect (void)
 Connect to the remote host. More...
 
void disconnect (void)
 Disconnect from the remote host. More...
 
bool isIdle (void) const
 Check if the connection is idle. More...
 

Public Attributes

sigc::signal< void > connected
 A signal that is emitted when a connection has been established. More...
 

Detailed Description

A base class for creating a TCP client connection.

Author
Tobias Blomberg
Date
2003-04-12

This is a base class for creating TCP client connections. It should notmally not be used direclt but rather the TcpClient class should be used.

Definition at line 121 of file AsyncTcpClientBase.h.

Constructor & Destructor Documentation

◆ TcpClientBase() [1/3]

Async::TcpClientBase::TcpClientBase ( TcpConnection con)
explicit

Constructor.

Parameters
conThe connection object associated with this client

The object will be constructed and variables will be initialized but no connection will be created until the connect function (see TcpClient::connect) is called. When using this variant of the constructor the connect method which take host and port must be used.

◆ TcpClientBase() [2/3]

Async::TcpClientBase::TcpClientBase ( TcpConnection con,
const std::string &  remote_host,
uint16_t  remote_port 
)

Constructor.

Parameters
conThe connection object associated with this client
remote_hostThe hostname of the remote host
remote_portThe port on the remote host to connect to

The object will be constructed and variables will be initialized but no connection will be created until the connect function (see TcpClient::connect) is called.

◆ TcpClientBase() [3/3]

Async::TcpClientBase::TcpClientBase ( TcpConnection con,
const IpAddress remote_ip,
uint16_t  remote_port 
)

Constructor.

Parameters
conThe connection object associated with this client
remote_ipThe IP address of the remote host
remote_portThe port on the remote host to connect to

The object will be constructed and variables will be initialized but no connection will be created until the connect function (see TcpClient::connect) is called.

◆ ~TcpClientBase()

Async::TcpClientBase::~TcpClientBase ( void  )

Destructor.

Member Function Documentation

◆ bind()

void Async::TcpClientBase::bind ( const IpAddress bind_ip)

Bind to the interface having the specified IP address.

Parameters
bind_ipThe IP address of the interface to bind to

◆ connect() [1/3]

void Async::TcpClientBase::connect ( const std::string &  remote_host,
uint16_t  remote_port 
)

Connect to the remote host.

Parameters
remote_hostThe hostname of the remote host
remote_portThe port on the remote host to connect to

This function will initiate a connection to the remote host. The connection must not be written to before the connected signal (see TcpClient::connected) has been emitted. If the connection is already established or pending, nothing will be done.

◆ connect() [2/3]

void Async::TcpClientBase::connect ( const Async::IpAddress remote_ip,
uint16_t  remote_port 
)

Connect to the remote host.

Parameters
remote_ipThe IP address of the remote host
remote_portThe port on the remote host to connect to

This function will initiate a connection to the remote host. The connection must not be written to before the connected signal (see TcpClient::connected) has been emitted. If the connection is already established or pending, nothing will be done.

◆ connect() [3/3]

void Async::TcpClientBase::connect ( void  )

Connect to the remote host.

This function will initiate a connection to the remote host. The connection must not be written to before the connected signal (see TcpClient::connected) has been emitted. If the connection is already established or pending, nothing will be done.

◆ disconnect()

void Async::TcpClientBase::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

Referenced by Async::TcpClient< ConT >::disconnect().

◆ isIdle()

bool Async::TcpClientBase::isIdle ( void  ) const
inline

Check if the connection is idle.

Returns
Returns true if the connection is idle

A connection being idle means that it is not connected nor connecting.

Definition at line 222 of file AsyncTcpClientBase.h.

Referenced by Async::TcpClient< ConT >::isIdle().

Member Data Documentation

◆ connected

sigc::signal<void> Async::TcpClientBase::connected

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

Examples:
AsyncFramedTcpClient_demo.cpp, and AsyncTcpClient_demo.cpp.

Definition at line 227 of file AsyncTcpClientBase.h.


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