gloox 1.0
Public Member Functions

ConnectionTCPClient Class Reference

This is an implementation of a simple TCP connection. More...

#include <connectiontcpclient.h>

Inheritance diagram for ConnectionTCPClient:
Inheritance graph
[legend]

List of all members.

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

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@camaya.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: