Dave Tweed escreveu: > Vitaliy wrote: > = >> Olin Lathrop wrote: >> = >>> ... you have to think carefully about what the receiving node might >>> do if it receives two separate valid commands. A sequence number is >>> the usual way around this, but there are other strategies. >>> = >> - Avoid "vague" commands ("toggle") in favor of more specific ones >> ("turn off") >> = > > Specifically, look up the term "idempotent", especially as it applies to > computer networks. > > -- Dave Tweed > = 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. 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. There must be provision for a synchronization packet which is not sequenced itself. 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