gloox  1.0
Public Member Functions | List of all members
ConnectionTCPClient Class Reference

#include <connectiontcpclient.h>

Inheritance diagram for ConnectionTCPClient:
Inheritance graph
[legend]

Public Member Functions

 ConnectionTCPClient (const LogSink &logInstance, const std::string &server, int port=-1)
 ConnectionTCPClient (ConnectionDataHandler *cdh, const LogSink &logInstance, const std::string &server, int port=-1)
virtual ~ConnectionTCPClient ()
virtual ConnectionError recv (int timeout=-1)
virtual ConnectionError connect ()
virtual ConnectionBasenewInstance () const
- Public Member Functions inherited from ConnectionTCPBase
 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 ()
ConnectionState state () const
void registerConnectionDataHandler (ConnectionDataHandler *cdh)
void setServer (const std::string &server, int port=-1)
const std::string & server () const
int port () const

Additional Inherited Members

- Protected Attributes inherited from ConnectionBase
ConnectionDataHandlerm_handler
ConnectionState m_state
std::string m_server
int m_port

Detailed Description

This is an implementation of a simple TCP connection.

You should only need to use this class directly if you need access to some special feature, like the raw socket(), or if you need HTTP proxy support (see gloox::ConnectionHTTPProxy for more information).

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
0.9

Definition at line 36 of file connectiontcpclient.h.

Constructor & Destructor Documentation

ConnectionTCPClient ( const LogSink logInstance,
const std::string &  server,
int  port = -1 
)

Constructs a new ConnectionTCPClient object.

Parameters
logInstanceThe log target. Obtain it from ClientBase::logInstance().
serverA server to connect to.
portThe port to connect to. The default of -1 means that XMPP SRV records will be used to find out about the actual host:port.
Note
To properly use this object, you have to set a ConnectionDataHandler using registerConnectionDataHandler(). This is not necessary if this object is part of a 'connection chain', e.g. with ConnectionHTTPProxy.

Definition at line 41 of file connectiontcpclient.cpp.

ConnectionTCPClient ( ConnectionDataHandler cdh,
const LogSink logInstance,
const std::string &  server,
int  port = -1 
)

Constructs a new ConnectionTCPClient object.

Parameters
cdhAn ConnectionDataHandler-derived object that will handle incoming data.
logInstanceThe log target. Obtain it from ClientBase::logInstance().
serverA server to connect to.
portThe 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 47 of file connectiontcpclient.cpp.

~ConnectionTCPClient ( )
virtual

Virtual destructor

Definition at line 54 of file connectiontcpclient.cpp.

Member Function Documentation

ConnectionError connect ( )
virtual

Used to initiate the connection.

Returns
Returns the connection state.

Implements ConnectionBase.

Definition at line 63 of file connectiontcpclient.cpp.

ConnectionBase * newInstance ( ) const
virtual

This function returns a new instance of the current ConnectionBase-derived object. The idea is to be able to 'clone' ConnectionBase-derived objects without knowing of what type they are exactly.

Returns
A new Connection* instance.

Implements ConnectionBase.

Definition at line 58 of file connectiontcpclient.cpp.

ConnectionError recv ( int  timeout = -1)
virtual

Use this periodically to receive data from the socket.

Parameters
timeoutThe timeout to use for select in microseconds. Default of -1 means blocking.
Returns
The state of the connection.

Implements ConnectionBase.

Definition at line 121 of file connectiontcpclient.cpp.


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