QTcpSocket *checkSocket=new QTcpSocket();
To copy to clipboard, switch view to plain text mode
You create a new QTcpSocket instance, of course its pointer will be different.
If you want to access the socket by socket descriptor, then better us a QHash instead of a list, using the socket descriptor as the key
QHash<int, QTcpSocket*> clientConnections;
To copy to clipboard, switch view to plain text mode
clientConnections.insert(socketDescriptor, clientConnection);
clientConnections.insert(socketDescriptor, clientConnection);
To copy to clipboard, switch view to plain text mode
Retrieval
QTcpSocket *socket
= clientConnections.
value(socketDescriptor
);
QTcpSocket *socket = clientConnections.value(socketDescriptor);
To copy to clipboard, switch view to plain text mode
Any reason you want to use the socketDescriptor as the identifier? Where do you store that that you cannot store the pointer to the QTcpSocket directly?
Cheers,
_
Bookmarks