Home · Modules · Classes · Namespaces · Functions

QxtTcpConnectionManager Class Reference
[QxtNetwork module]

The QxtTcpConnectionManager class accepts TCP connections and maintains a connection pool More...

    #include <QxtTcpConnectionManager>

Inherits QxtAbstractConnectionManager.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QxtTcpConnectionManager class accepts TCP connections and maintains a connection pool

QxtTcpConnectionManager is a standardized interface for accepting and tracking incoming TCP connections.

Each incoming connection is assigned an arbitrary, opaque client ID number. This number can be used to retrieve the QTcpSocket associated with it. A list of IDs for all current connections can be retrieved with the clients() function.

Like QTcpServer, QxtTcpConnectionManager can listen for incoming connections on a specified interface and port, and like QTcpServer you may override the incomingConnection() function to change the handling of new connections. This is, for instance, where you would create a QSslSocket to encrypt communications.

See also QTcpServer.


Member Function Documentation

QxtTcpConnectionManager::QxtTcpConnectionManager ( QObject * parent )

Constructs a new QxtTcpConnectionManager object with the specified parent.

QIODevice * QxtTcpConnectionManager::incomingConnection ( int socketDescriptor )   [virtual protected]

This function is called when a new TCP connection becomes available. The parameter is the native socketDescriptor for the connection, suitable for use in QTcpSocket::setSocketDescriptor.

The default implementation returns a new QTcpSocket with the specified descriptor. Subclasses may return QTcpSocket subclasses, such as QSslSocket.

bool QxtTcpConnectionManager::listen ( QHostAddress iface = QHostAddress::Any, int port = 80 )

Listens on the specified interface iface on the specified port for connections. If iface is QHostAddress::Any, listens on all interfaces.

Returns true on success; otherwise returns false.

QNetworkProxy QxtTcpConnectionManager::proxy () const

Returns the proxy in use for the connection manager.

See also setProxy() and QTcpServer::proxy().

void QxtTcpConnectionManager::setProxy ( const QNetworkProxy & proxy )

Sets an explicit network proxy for the connection manager.

See also proxy() and QTcpServer::setProxy().

void QxtTcpConnectionManager::stopListening ()

Stops listening for connections. Any connections still open will remain connected.


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1