gloox
0.9.9.12
|
#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 (int &totalIn, int &totalOut) |
int | socket () const |
void | setSocket (int socket) |
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 |
virtual ConnectionBase * | newInstance () const =0 |
This is a base class for a simple TCP connection.
You should not need to use this class directly.
Definition at line 37 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 48 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 57 of file connectiontcpbase.cpp.
|
virtual |
Virtual destructor
Definition at line 73 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 151 of file connectiontcpbase.cpp.
|
virtual |
Disconnects an established connection. NOOP if no active connection exists.
Implements ConnectionBase.
Definition at line 80 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 145 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 104 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 115 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 96 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 88 of file connectiontcpbase.h.