Async 1.7.0
|
A_brief_class_description. More...
#include <AsyncTcpPrioClient.h>
Public Member Functions | |
TcpPrioClient (size_t recv_buf_len=ConT::DEFAULT_RECV_BUF_LEN) | |
Constructor. | |
TcpPrioClient (const TcpPrioClient &)=delete | |
Disallow copy construction. | |
TcpPrioClient & | operator= (const TcpPrioClient &)=delete |
Disallow copy assignment. | |
virtual | ~TcpPrioClient (void) |
Destructor. | |
virtual void | disconnect (void) |
Disconnect from the remote host. | |
Public Member Functions inherited from Async::TcpConnection | |
TcpConnection (size_t recv_buf_len=DEFAULT_RECV_BUF_LEN) | |
Constructor. | |
TcpConnection (int sock, const IpAddress &remote_addr, uint16_t remote_port, size_t recv_buf_len=DEFAULT_RECV_BUF_LEN) | |
Constructor. | |
virtual | ~TcpConnection (void) |
Destructor. | |
virtual TcpConnection & | operator= (TcpConnection &&other) |
Move assignmnt operator. | |
void | setRecvBufLen (size_t recv_buf_len) |
Set a new receive buffer size. | |
virtual int | write (const void *buf, int count) |
Write data to the TCP connection. | |
const IpAddress & | remoteHost (void) const |
Return the IP-address of the remote host. | |
uint16_t | remotePort (void) const |
Return the remote port used. | |
bool | isConnected (void) const |
Check if the connection is established or not. | |
bool | isIdle (void) const |
Check if the connection is idle. | |
Public Member Functions inherited from Async::TcpPrioClientBase | |
TcpPrioClientBase (TcpConnection *con) | |
Constructor. | |
TcpPrioClientBase (TcpConnection *con, const std::string &remote_host, uint16_t remote_port)=delete | |
Deleted constructor not making sense in this context. | |
TcpPrioClientBase (TcpConnection *con, const IpAddress &remote_ip, uint16_t remote_port)=delete | |
Deleted constructor not making sense in this context. | |
virtual | ~TcpPrioClientBase (void) |
Destructor. | |
void | setReconnectMinTime (unsigned t) |
Minimum time between reconnects. | |
void | setReconnectMaxTime (unsigned t) |
Maximum time between reconnects. | |
void | setReconnectBackoffPercent (unsigned p) |
Percent to increase reconnect time with each try. | |
void | setReconnectRandomizePercent (unsigned p) |
Percent to randomize reconnect time. | |
void | setService (const std::string &srv_name, const std::string &srv_proto, const std::string &srv_domain) |
Use a DNS service resource record for connections. | |
void | addStaticSRVRecord (DnsResourceRecordSRV::Ttl ttl, DnsResourceRecordSRV::Prio prio, DnsResourceRecordSRV::Weight weight, DnsResourceRecordSRV::Port port, DnsResourceRecordSRV::Target target) |
Add a static service resource record. | |
const std::string & | service (void) const |
Get the full service name. | |
void | connect (void) |
Connect to the remote host. | |
void | connect (const std::string &remote_host, uint16_t remote_port)=delete |
Deleted function not making sense in this context. | |
void | connect (const Async::IpAddress &remote_ip, uint16_t remote_port)=delete |
Deleted function not making sense in this context. | |
bool | isIdle (void) const |
Check if the connection is idle. | |
bool | isPrimary (void) const |
virtual TcpClientBase & | operator= (TcpClientBase &&other) |
Move assignmnt operator. | |
Public Member Functions inherited from Async::TcpClientBase | |
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. | |
virtual | ~TcpClientBase (void) |
Destructor. | |
std::string | remoteHostName (void) const |
Get the name of the remote host as given to connect() | |
void | setBindIp (const IpAddress &bind_ip) |
Bind to the interface having the specified IP address. | |
const IpAddress & | bindIp (void) const |
Get the bind 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. | |
bool | isIdle (void) const |
Check if the connection is idle. | |
TcpConnection * | conObj (void) |
Return the connection object for this client connection. |
Protected Member Functions | |
virtual void | closeConnection (void) |
Disconnect from the remote peer. | |
virtual void | onDisconnected (TcpConnection::DisconnectReason reason) |
Called when a connection has been terminated. | |
virtual TcpClientBase * | newTcpClient (void) |
Allocate a new TcpClient object. | |
virtual void | emitDisconnected (TcpConnection::DisconnectReason reason) |
Emit the disconnected signal. | |
Protected Member Functions inherited from Async::TcpConnection | |
void | setSocket (int sock) |
Setup information about the connection. | |
void | setRemoteAddr (const IpAddress &remote_addr) |
Setup information about the connection. | |
void | setRemotePort (uint16_t remote_port) |
Setup information about the connection. | |
int | socket (void) const |
Return the socket file descriptor. | |
virtual int | onDataReceived (void *buf, int count) |
Called when data has been received on the connection. | |
Protected Member Functions inherited from Async::TcpPrioClientBase | |
void | initialize (void) |
Must be called from the inheriting class constructor. | |
virtual void | connectionEstablished (void) override |
Called when the connection has been established to the server. | |
Protected Member Functions inherited from Async::TcpClientBase | |
virtual void | emitConnected (void) |
Additional Inherited Members | |
Public Types inherited from Async::TcpConnection | |
enum | DisconnectReason { DR_HOST_NOT_FOUND , DR_REMOTE_DISCONNECTED , DR_SYSTEM_ERROR , DR_RECV_BUFFER_OVERFLOW , DR_ORDERED_DISCONNECT , DR_PROTOCOL_ERROR , DR_SWITCH_PEER , DR_BAD_STATE } |
Reason code for disconnects. More... | |
Static Public Member Functions inherited from Async::TcpConnection | |
static const char * | disconnectReasonStr (DisconnectReason reason) |
Translate disconnect reason to a string. | |
Public Attributes inherited from Async::TcpConnection | |
sigc::signal< void, TcpConnection *, DisconnectReason > | disconnected |
A signal that is emitted when a connection has been terminated. | |
sigc::signal< int, TcpConnection *, void *, int > | dataReceived |
A signal that is emitted when data has been received on the connection. | |
sigc::signal< void, bool > | sendBufferFull |
A signal that is emitted when the send buffer status changes. | |
Public Attributes inherited from Async::TcpClientBase | |
sigc::signal< void > | connected |
A signal that is emitted when a connection has been established. | |
Static Public Attributes inherited from Async::TcpConnection | |
static const int | DEFAULT_RECV_BUF_LEN = 1024 |
The default length of the reception buffer. |
A_brief_class_description.
A_detailed_class_description
Definition at line 123 of file AsyncTcpPrioClient.h.
|
inlineexplicit |
Constructor.
recv_buf_len | The length of the receiver buffer to use |
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.
Definition at line 136 of file AsyncTcpPrioClient.h.
References Async::TcpPrioClientBase::initialize(), and Async::TcpPrioClientBase::TcpPrioClientBase().
Referenced by operator=(), and TcpPrioClient().
|
delete |
Disallow copy construction.
References TcpPrioClient().
|
inlinevirtual |
Destructor.
Definition at line 155 of file AsyncTcpPrioClient.h.
|
inlineprotectedvirtual |
Disconnect from the remote peer.
This function is used internally to close the connection to the remote peer.
Reimplemented from Async::TcpConnection.
Definition at line 194 of file AsyncTcpPrioClient.h.
References Async::TcpClientBase::closeConnection().
|
inlinevirtual |
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 from Async::TcpConnection.
Definition at line 164 of file AsyncTcpPrioClient.h.
References Async::TcpPrioClientBase::disconnect().
|
inlineprotectedvirtual |
Emit the disconnected signal.
reason | The reason for the disconnection |
Reimplemented from Async::TcpConnection.
Definition at line 229 of file AsyncTcpPrioClient.h.
|
inlineprotectedvirtual |
Allocate a new TcpClient object.
This function is used to allocate a new TcpClient object. That object is used when in the background trying to connect to a higher prioritized server. Note that the object should be a "normal" TcpClient and not a TcpPrioClient.
Implements Async::TcpPrioClientBase.
Definition at line 224 of file AsyncTcpPrioClient.h.
References Async::TcpConnection::TcpClientBase.
|
inlineprotectedvirtual |
Called when a connection has been terminated.
reason | The reason for the disconnect |
This function will be called when the connection has been terminated.
Reimplemented from Async::TcpConnection.
Definition at line 206 of file AsyncTcpPrioClient.h.
References Async::TcpPrioClientBase::onDisconnected().
|
delete |
Disallow copy assignment.
References TcpPrioClient().