Answer the question
In order to leave comments, you need to log in
How not to skip UDP packets?
I am developing a UDP server. 10-15 datagrams arrive at the server at the same time, for each datagram the server has an action. The action takes 0.5 seconds (connection to the server). The problem is that the server reads one from a packet of datagrams, and ignores the rest. The problem was solved by creating a thread for connection. But still, the question of the correctness of the method worries. Maybe there is some class that can collect datagram messages and issue them when they are needed?
Answer the question
In order to leave comments, you need to log in
This is exactly what they do - the udp server should only be concerned with waiting for connections and collecting incoming commands in the queue (maximum checking the correctness of the incoming data and their order), but long-term processing (actually any) should be handled by a separate worker in a separate thread (or in same but when using asynchronous sockets).
The choice of classes and tools is entirely up to you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question