[newbie] trying socket as a replacement for nc

Grant Edwards invalid at invalid.invalid
Fri Dec 13 17:57:10 CET 2013


On 2013-12-13, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Dec 14, 2013 at 3:10 AM, Grant Edwards <invalid at invalid.invalid> wrote:
>> Adding boundaries to a TCP stream achieves the same goal (and isn't
>> that hard to do), but since there's no standard for it, people keep
>> having to reinvent it (often badly and always incompaibly).
>
> Nearest to a standard would be the way heaps of internet protocols are
> line-based - SMTP, POP, IMAP, FTP, and to a lesser extent HTTP as
> well. The end-of-line sequence \r\n delimits messages.

And that works very nicely for things that transport text.  It's easy
to implement, easy to debug, easy to test.  But, when you need to
transport binary data, it gets ugly and compatibility problems start
to arise pretty quickly.

One could also borrow standards from the old-school serial world and
us the SYN/STX/ETX framing with byte stuffing used by HDLC et al.

-- 
Grant Edwards               grant.b.edwards        Yow! My vaseline is
                                  at               RUNNING...
                              gmail.com            



More information about the Python-list mailing list