QTcpServer::hasPendingConnections () - socket creation issue
Dear All,
From the fine QT manual:
"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."
Now the question is:
reimplementing the function prevents the creation of a QTcpSocket? -- meaning that I'm only interested in the socketDescriptor for passing it into another thread and creating the socket there...
Regards,
Pedro Doria Meunier
Re: QTcpServer::hasPendingConnections () - socket creation issue
I didnt get u fully.
here is how u do
u have to modify the incomingconnection(int socketDescriptor).
create a class:
Code:
{
Q_OBJECT
public:
protected:
void incomingConnection(int socketDescriptor);
}
From ur main application, derive the pointer or object of this class and then start server by listening.
Then u will get socketDescriptor everytime a new client connect.
Hope this helps.