Lightwight socket IO wrapper

Cameron Simpson cs at zip.com.au
Mon Sep 21 03:55:14 CEST 2015


On 21Sep2015 10:34, Chris Angelico <rosuav at gmail.com> wrote:
>If you're going to add sequencing and acknowledgements to UDP,
>wouldn't it be easier to use TCP and simply prefix every message with
>a two-byte length?

Frankly, often yes. That's what I do. (different length encoding, but 
otherwise...)

UDP's neat if you do not care if a packet fails to arrive and if you can 
guarentee that your data fits in a packet in the face of different MTUs. 

I like TCP myself, most of the time. Another nice thing about TCP is that wil a 
little effort you get to pack multiple data packets (or partial data packets) 
into a network packet, etc.

Cheers,
Cameron Simpson <cs at zip.com.au>

If you lie to the compiler, it will get its revenge.    - Henry Spencer


More information about the Python-list mailing list