Hello, I'm trying to make server/client in Qt.
TCP Server takes maximum 4 connections from client.
To create...
// server.h
class Server : public QTcpServer{
...
QList<QTcpSocket *> list;
}
// server.cpp
Server::start(){
QTcpSocket *curr = nextPendingConnection();
connect(curr, SIGNAL(disconnected()), curr, SLOT(deleteLater()));
list.append(curr);
}
This code would delete the memory by connecting disconnected() signal to deleteLater() but I don't know how to remove the pointer from list. How can I know which connection is closed?
I want to remove disconnected QTcpSocket pointer element from list to manage connections.
please help...
(I think if there was a SIGNAL(disconnected(QTcpSocket *)), this must be so much easier)