Hi, I’ve been making a server and client program. It is mostly going well, apart from the fact when clients join and send lots of packets to the server, the server starts to get behind in responding to the clients. The strange thing is that i have a while loop executed each frame in the server that doesn’t break until there is a timeout(no more messages to receive). And I only reply to the most recent message from each client and discard the rest. The server works fine with say 2 clients sending at 30 packets per second, but if i keep adding clients (say 4 or 5), this problem starts occurring.
The only reason I think that this could happen is if the clients are sending so many packets that the server gets stuck in the while loop forever, but this isn’t the case. The server replies, it just can’t reply as fast as the clients are sending the packets, and over time it is replying to packets that clients sent 20 or 30 seconds ago or even longer if I just leave it there. I don’t know why it is replying to old packets though - my while loop should receive every message and remove all the old messages. It shouldn’t be replying to messages it received 20 seconds ago when there are packets that have just arrived.
Does anyone know why this could be?
Thanks,
roland