[newbie] trying socket as a replacement for nc
Roy Smith
roy at panix.com
Mon Dec 16 09:03:17 EST 2013
On Friday, December 13, 2013 5:58:49 AM UTC+8, Chris Angelico wrote:
> > Now, if you want reliability AND datagrams, it's a lot easier to add
> > boundaries to a TCP stream (sentinel or length prefixes) than to add
> > reliability to UDP...
In article <11cb8cd3-7a12-46b2-abc6-53fbc2a54525 at googlegroups.com>,
88888 Dihedral <dihedral88888 at gmail.com> wrote:
> It is trivial to use UDP with
> forward error correction such as
> the CD in 1982.
CD uses Reed-Solomon coding, which is great for correcting the types of
errors expected on a CD. Namely, bursts of bit errors caused by
localized failure of the optical coating, scratches, dirt, etc. It
wouldn't be hard to build something like that on top of UDP, but those
sorts of errors are not what you typically see in networks.
It's relatively rare for a bit to get corrupted in a network packet.
And, when it does, it's almost certainly caught by lower-level
mechanisms such as ethernet frame CRC. Much more likely is for a packet
to get dropped because of queue overflow, or for sequential packets to
arrive out of order due to multiple transmission paths with different
latencies. Those are the sorts of things TCP protects against.
Sure, you could implement retransmit timers and packet reordering in
user code, but it would be distinctly non-trivial and ultimately you
would end up reinventing most of TCP. Except that your implementation
would suck compared to the kernel algorithms which have been
continuously tested and fine-tuned for the past 30 years.
More information about the Python-list
mailing list