Dario Greggio escreveu: > Isaac Marino Bavaresco ha scritto: > = >> I use two sequence numbers, one for the packet and other for the command >> itself. It is useful for networks with routing where the packets may >> arrive out of order or multiple times due to routing problems. >> = > > interesting... > > = >> If the sequence number of the arriving packet if less or equal to the >> last received one, just ignore it. If it is newer (inside a >> predetermined window), check the command sequence number. If the command >> sequence number is exactly equal to the last one, just resend the last >> answer but don't execute anything. If the command sequence number is >> newer (inside a window limit), execute it, send the answer and store the >> answer. >> = > > ...worth investigating more. I agree on the second part, but why having t= wo? > = I just sent a post that may explain better it. >> There must be provision for a synchronization packet which is not >> sequenced itself. >> = > > could you explain more this one? > = If the nodes lose connection for too long the sequence numbers may get very far apart (the sender is using number 2000 and the receiver received only up to number 100 e.g.). The window I mentioned, is the maximum difference between the sequence numbers of two consecutive packets or commands. If a packet arrives with a sequence number that is 256 (for instance, this is the value I use) over the previous, it is discarded and the node keeps the sequence number it had before. If this happens, the nodes stop sending regular packets and start sending special packets telling what numbers it is using and asking for synching. The other node will always respond to these packets, saying it received the request and providing a challenge (also a sequence number). After receiving this packet, the sender node answers to the challenge and assume they are synched again. When the receiver node receives the correct answer to the challenge, it also assumes they are synched again. Regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist