Client/Server with a lot of connections
-
Dear ALL users
I am new to this forum and hope that could find out any solution about my problemI wrote a Client/Server application that works like messengers programs
Each client make tcp socket connection to the server and send their data.
My program works find with my test environment that consist of 15 clients
The problem occurs when client connection increase and it seems that my server misses some of them
For example when I try to send packet from different client ( 100 Client ) to my server , server shows that only 90 client connected and 10 client is not connected,
Another issues is that a server maybe loss packet from client that make a lot of connections to servers
Is there any idea about this issues? Any point that I should considered?
Thanks for your attentions
-
Yes, i'm using thread
im using qtcpsocket ( Listener as server )
when a connection socket received from client, server received client data
a part of my code is
void NetworkManager::incomingConnection(int socketfd)
{
QTcpSocket *client = new QTcpSocket(this);
client->setSocketDescriptor(socketfd);
clients.insert(client);
qDebug() « "new connection from new client";
client->peerAddress().toString());
connect(client, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(client, SIGNAL(disconnected()), this, SLOT(disconnected()));
} -
We would need the whole implementation and debug it. But I guess it would be more productive when you watch some tutorial about high performance TCP server designs and stuff. This is a nice tutorial I can recommend: https://www.youtube.com/watch?v=zMgbVN3uQ-E
Cheers