Re: [Plib-devel] Networking Code
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-08-24 06:20:52
|
Michael Kurth wrote: > > > So, you NEED a TCP-like protocol where every packet it GUARANTEED to > arrive for sending > > "one-shot" messages - AND a UDP-like protocol where time-critical - but > often-repeated > > messages may or may not make it. > > > > If a UDP packet is critical then set a flag in your packet header requesting > an ACK be sent back. This will of course mean you need to design a method of > knowing which packets you sent required an ACK, clearing ACK'd packets, > knowing which ones haven't been ACK'd yet, and resending the packet. ...coping with ACK packets that get lost - resulting in retransmitted packets appearing twice at the destination...etc, etc, etc. Notice that the probability of an ACK getting lost are identical to the probability of an outgoing packet getting lost. ...coping with an ACK that refers to a packet you already retransmitted. ...realising that packets can now arrive out of sequence (actually, that was always possible - even with UDP). There are a lot of nasty little traps you can fall into. I think that in the end, you are just better off using TCP where it's needed and UDP when it isn't. I believe that's what Quake does. -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |