Catching cloned packets
I am working on a reliability layer on top of udp and im currently implementing unordered reliable sends. The problem is packets that arrive more than once, i can't figure out a way to detect this with unordered sends. With sequenced and ordered sends, this is not a problem (if a packet has already arrived it will be dropped or queued, we know this in this case since we know that last recieved packet's number). But that dosn't apply when dealing with truly unordered reliable sends, you dont have a last packet number to compare with there. Sure you could make a huge lookup array of recieved packets where you save recent packets, and just decide that if a packet is very out of order, we drop it. But then it really isn't sure to be reliable anymore, i mean a packet can take a few seconds to get there on internet. Im sure someone has toughout a better way. :-) Any input is appreciated, thanks in advance!
Shields up! Rrrrred alert!
This is just an idea,never test it or anything.
You could try something like time stamped packets .(Dont put in a time,just syc with the client a range in between a stamp byte can be in).Change the time stamp range at some fixed rate.
Keep the current and previous stamp range
So if a packet comes in with an invalid/previous stamp you can drop it or whatever.
This way you might only have to look at packets which are within a time range and might be able keep out too late packets
Reminds:Just an idea (Accepts no responsibility with what you do with it ..... bla,bla.You know,that standard stuff which comes with free software) ;-)
You could try something like time stamped packets .(Dont put in a time,just syc with the client a range in between a stamp byte can be in).Change the time stamp range at some fixed rate.
Keep the current and previous stamp range
So if a packet comes in with an invalid/previous stamp you can drop it or whatever.
This way you might only have to look at packets which are within a time range and might be able keep out too late packets
Reminds:Just an idea (Accepts no responsibility with what you do with it ..... bla,bla.You know,that standard stuff which comes with free software) ;-)
______________________________________________________________________________________________________
[AirBash.com]
[AirBash.com]
For reliable, un-ordered packets, you could re-use your logic for ordered packets. I'm assuming your ordered code hangs on to all packets received out of order, until the missing packet can get re-sent, and then delivers all of them, and maintains a sliding window of earliest and latest sequence numbers you'd accept.
You can use that same code with a very small modification: deliver the packet as soon as it comes in, if you haven't already. Then, when the "missing" packet shows up, you don't re-deliver the delivered packets, you just flush your window and dispose the copies of the saved packets.
If your implementation of reliable, ordered packets is not using a packet store and a sliding window, then you may have less to re-use -- perhaps you could consider re-implementing at that point :-)
You can use that same code with a very small modification: deliver the packet as soon as it comes in, if you haven't already. Then, when the "missing" packet shows up, you don't re-deliver the delivered packets, you just flush your window and dispose the copies of the saved packets.
If your implementation of reliable, ordered packets is not using a packet store and a sliding window, then you may have less to re-use -- perhaps you could consider re-implementing at that point :-)
enum Bool { True, False, FileNotFound };
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement