Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QTcpServer::incomingConnection ( int  socketDescriptor  )  [protected, virtual]

This virtual function is called by QTcpServer when a new connection is available. The socketDescriptor argument is the native socket descriptor for the accepted connection.

The base implementation creates a QTcpSocket, sets the socket descriptor and then stores the QTcpSocket in an internal list of pending connections. Finally newConnection() is emitted.

Reimplement this function to alter the server's behavior when a connection is available.

If this server is using QNetworkProxy then the socketDescriptor may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor().

See also:
newConnection(), nextPendingConnection()

Definition at line 505 of file qtcpserver.cpp.

References QAbstractSocket::setSocketDescriptor().

{
#if defined (QTCPSERVER_DEBUG)
    qDebug("QTcpServer::incomingConnection(%i)", socketDescriptor);
#endif

    QTcpSocket *socket = new QTcpSocket(this);
    socket->setSocketDescriptor(socketDescriptor);
    d_func()->pendingConnections.append(socket);
}


Generated by  Doxygen 1.6.0   Back to index