gloox  1.0.27
Public Member Functions | List of all members
ConnectionTCPServer Class Reference

#include <connectiontcpserver.h>

Inheritance diagram for ConnectionTCPServer:
Inheritance graph
[legend]

Public Member Functions

 ConnectionTCPServer (ConnectionHandler *ch, const LogSink &logInstance, const std::string &ip, int port)
 
virtual ~ConnectionTCPServer ()
 
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 listening TCP connection.

You should not need to use this class directly.

Author
Jakob Schröter js@ca.nosp@m.maya.nosp@m..net
Since
0.9

Definition at line 36 of file connectiontcpserver.h.

Constructor & Destructor Documentation

◆ ConnectionTCPServer()

ConnectionTCPServer ( ConnectionHandler ch,
const LogSink logInstance,
const std::string &  ip,
int  port 
)

Constructs a new ConnectionTCPServer object.

Parameters
chA ConnectionHandler-derived object that will handle incoming connections.
logInstanceThe log target. Obtain it from ClientBase::logInstance().
ipThe local IP address to listen on. This must not be a hostname. Leave this empty to listen on all local interfaces.
portThe port to listen on.

Definition at line 69 of file connectiontcpserver.cpp.

◆ ~ConnectionTCPServer()

~ConnectionTCPServer ( )
virtual

Virtual destructor

Definition at line 76 of file connectiontcpserver.cpp.

Member Function Documentation

◆ connect()

ConnectionError connect ( )
virtual

This function actually starts listening on the port given in the constructor.

Implements ConnectionBase.

Definition at line 85 of file connectiontcpserver.cpp.

◆ newInstance()

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 80 of file connectiontcpserver.cpp.

◆ recv()

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 176 of file connectiontcpserver.cpp.


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