ConnectionTCPClient Class Reference

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

#include <connectiontcpclient.h>

Inheritance diagram for ConnectionTCPClient:

Inheritance graph
[legend]
Collaboration diagram for ConnectionTCPClient:

Collaboration 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:
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.
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 44 of file connectiontcpclient.cpp.

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

Constructs a new ConnectionTCPClient object.

Parameters:
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 50 of file connectiontcpclient.cpp.

~ConnectionTCPClient (  )  [virtual]

Virtual destructor

Definition at line 57 of file connectiontcpclient.cpp.


Member Function Documentation

ConnectionError recv ( int  timeout = -1  )  [virtual]

Use this periodically to receive data from the socket and to feed the parser.

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

Implements ConnectionBase.

Definition at line 124 of file connectiontcpclient.cpp.

ConnectionError connect (  )  [virtual]

Used to initiate the connection.

Returns:
Returns the connection state.

Implements ConnectionBase.

Definition at line 66 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 61 of file connectiontcpclient.cpp.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 08:50:32 2007 for gloox by  doxygen 1.5.3-20071008