OK, I am aware that UDP doesn't guarantee delivery, but I had hoped to catch all by having the RecvFrom in a thread with TimeCritical priority and just quickly moving the incoming messages into a buffer. However, when the rate of messages get up to about 1000 1500 bytes messages per seconds a few are missed. I have verified with WireShark that the messages actually are received by the computer.
I am pretty sure that the messages are lost in the extremely short time from the RecvFrom returns and until it is called again.
Is there any way to "catch all", since the messages apparently are received?
Thanks.
Is there any way to "catch all", since the messages apparently are received?
No. If you are not fast enough reading messages from the socket buffer and this receive buffer fills up, the messages simply get dropped. It does not matter if they were received on the computer and are visible with Wireshark, all what matters is if they end up in the sockets receive buffer.
You might try to increase this buffer in order to make a loss less likely but it can still happen. Unreliability of delivery is one of the trade-offs you have with UDP and there is no magic which will fix it. Either you can cope with packet loss or you have to keep track of loss and somehow request that the message gets send again.