gloox
1.0.28
|
#include <connectiontcpbase.h>
Public Member Functions | |
ConnectionTCPBase (const LogSink &logInstance, const std::string &server, int port=-1) | |
ConnectionTCPBase (ConnectionDataHandler *cdh, const LogSink &logInstance, const std::string &server, int port=-1) | |
virtual | ~ConnectionTCPBase () |
virtual bool | send (const std::string &data) |
virtual ConnectionError | receive () |
virtual void | disconnect () |
virtual void | cleanup () |
virtual void | getStatistics (long int &totalIn, long int &totalOut) |
int | socket () const |
void | setSocket (int socket) |
virtual int | localPort () const |
virtual const std::string | localInterface () const |
Public Member Functions inherited from ConnectionBase | |
ConnectionBase (ConnectionDataHandler *cdh) | |
virtual | ~ConnectionBase () |
virtual ConnectionError | connect ()=0 |
virtual ConnectionError | recv (int timeout=-1)=0 |
ConnectionState | state () const |
void | registerConnectionDataHandler (ConnectionDataHandler *cdh) |
void | setServer (const std::string &server, int port=-1) |
const std::string & | server () const |
int | port () const |
virtual ConnectionBase * | newInstance () const =0 |
Additional Inherited Members | |
Protected Attributes inherited from ConnectionBase | |
ConnectionDataHandler * | m_handler |
ConnectionState | m_state |
std::string | m_server |
int | m_port |
This is a base class for a simple TCP connection.
You should not need to use this class directly.
Definition at line 44 of file connectiontcpbase.h.
ConnectionTCPBase | ( | const LogSink & | logInstance, |
const std::string & | server, | ||
int | port = -1 |
||
) |
Constructs a new ConnectionTCPBase object.
logInstance | The log target. Obtain it from ClientBase::logInstance(). |
server | A server to connect to. |
port | The port to connect to. The default of -1 means that XMPP SRV records will be used to find out about the actual host:port. |
Definition at line 53 of file connectiontcpbase.cpp.
ConnectionTCPBase | ( | ConnectionDataHandler * | cdh, |
const LogSink & | logInstance, | ||
const std::string & | server, | ||
int | port = -1 |
||
) |
Constructs a new ConnectionTCPBase object.
cdh | An ConnectionDataHandler-derived object that will handle incoming data. |
logInstance | The log target. Obtain it from ClientBase::logInstance(). |
server | A server to connect to. |
port | The port to connect to. The default of -1 means that SRV records will be used to find out about the actual host:port. |
Definition at line 62 of file connectiontcpbase.cpp.
|
virtual |
Virtual destructor
Definition at line 79 of file connectiontcpbase.cpp.
|
virtual |
This function is called after a disconnect to clean up internal state. It is also called by ConnectionBase's destructor.
Reimplemented from ConnectionBase.
Definition at line 167 of file connectiontcpbase.cpp.
|
virtual |
Disconnects an established connection. NOOP if no active connection exists.
Implements ConnectionBase.
Definition at line 86 of file connectiontcpbase.cpp.
|
virtual |
Returns current connection statistics.
totalIn | The total number of bytes received. |
totalOut | The total number of bytes sent. |
Implements ConnectionBase.
Definition at line 161 of file connectiontcpbase.cpp.
|
virtual |
Returns the locally bound IP address.
Reimplemented from ConnectionBase.
Definition at line 203 of file connectiontcpbase.cpp.
|
virtual |
Returns the local port.
Reimplemented from ConnectionBase.
Definition at line 193 of file connectiontcpbase.cpp.
|
virtual |
Use this function to put the connection into 'receive mode', i.e. this function returns only when the connection is terminated.
Implements ConnectionBase.
Definition at line 112 of file connectiontcpbase.cpp.
|
virtual |
Use this function to send a string of data over the wire. The function returns only after all data has been sent.
data | The data to send. |
Implements ConnectionBase.
Definition at line 123 of file connectiontcpbase.cpp.
|
inline |
This function allows to set an existing socket with an established connection to use in this connection. You will still need to call connect() in order to negotiate the XMPP stream. You should not set a new socket after having called connect().
socket | The existing socket. |
Definition at line 103 of file connectiontcpbase.h.
|
inline |
Gives access to the raw socket of this connection. Use it wisely. You can select()/poll() it and use ConnectionTCPBase::recv( -1 ) to fetch the data.
Definition at line 95 of file connectiontcpbase.h.