> UDP packets can arrive out of order, so the "last packet sent" could
> certainly be the first packet that was actually sent. If you want to
> make sure they are ordered, then don't use UDP or plug some sort of
> timestamp or serial number into your data that can be used by your
> server/client to keep track of it.
>
It is exactly what I've done. I made a timestamp to see if i read an out
of order packet.
But happens this thing: if a send is delayed beyond the period, the
receive fails, and my buffer contains the old packet. It assumes that the
packet didn't arrive. When, in the next period, I go to read the packet,
I'd like to read the one relative to that period, not the older one. One
delay in the send makes the queue of messages shifted by one, so in every
period i read the message of the previous period. I thought that this was
avoidable simply making the kernel buffer contain only one packet, and
making a new arrive delete the old content of the buffer...
Any suggestions?
|