Async 1.5.0
|
A base class for creating a TCP client connection. More...
#include <AsyncTcpClientBase.h>
Public Member Functions | |
TcpClientBase (TcpConnection *con) | |
Constructor. | |
TcpClientBase (TcpConnection *con, const std::string &remote_host, uint16_t remote_port) | |
Constructor. | |
TcpClientBase (TcpConnection *con, const IpAddress &remote_ip, uint16_t remote_port) | |
Constructor. | |
~TcpClientBase (void) | |
Destructor. | |
void | bind (const IpAddress &bind_ip) |
Bind to the interface having the specified IP address. | |
void | connect (const std::string &remote_host, uint16_t remote_port) |
Connect to the remote host. | |
void | connect (const Async::IpAddress &remote_ip, uint16_t remote_port) |
Connect to the remote host. | |
void | connect (void) |
Connect to the remote host. | |
void | disconnect (void) |
Disconnect from the remote host. | |
bool | isIdle (void) const |
Check if the connection is idle. | |
Public Attributes | |
sigc::signal< void > | connected |
A signal that is emitted when a connection has been established. | |
A base class for creating a TCP client connection.
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.
|
explicit |
Constructor.
con | The 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.
Async::TcpClientBase::TcpClientBase | ( | TcpConnection * | con, |
const std::string & | remote_host, | ||
uint16_t | remote_port | ||
) |
Constructor.
con | The connection object associated with this client |
remote_host | The hostname of the remote host |
remote_port | The 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.
Async::TcpClientBase::TcpClientBase | ( | TcpConnection * | con, |
const IpAddress & | remote_ip, | ||
uint16_t | remote_port | ||
) |
Constructor.
con | The connection object associated with this client |
remote_ip | The IP address of the remote host |
remote_port | The 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.
Async::TcpClientBase::~TcpClientBase | ( | void | ) |
Destructor.
void Async::TcpClientBase::bind | ( | const IpAddress & | bind_ip | ) |
Bind to the interface having the specified IP address.
bind_ip | The IP address of the interface to bind to |
void Async::TcpClientBase::connect | ( | const Async::IpAddress & | remote_ip, |
uint16_t | remote_port | ||
) |
Connect to the remote host.
remote_ip | The IP address of the remote host |
remote_port | The 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.
void Async::TcpClientBase::connect | ( | const std::string & | remote_host, |
uint16_t | remote_port | ||
) |
Connect to the remote host.
remote_host | The hostname of the remote host |
remote_port | The 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.
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.
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().
|
inline |
Check 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().
sigc::signal<void> Async::TcpClientBase::connected |
A signal that is emitted when a connection has been established.
Definition at line 227 of file AsyncTcpClientBase.h.