Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61847

Re: [newbie] trying socket as a replacement for nc

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.04; 'messages.': 0.05; 'binary': 0.07; 'extent': 0.07; 'lesser': 0.07; 'nicely': 0.07; 'odd': 0.07; 'ugly': 0.07; 'badly': 0.09; 'bits': 0.09; 'boundaries': 0.09; 'http': 0.09; 'subject:trying': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ftp,': 0.16; 'imap,': 0.16; 'nearest': 0.16; 'precede': 0.16; 'reinvent': 0.16; 'smtp,': 0.16; 'tcp': 0.16; 'sat,': 0.16; 'so.': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'subject:] ': 0.20; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'byte': 0.24; 'test.': 0.24; 'text.': 0.24; 'cc:2**0': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'bigger': 0.30; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; 'pipe': 0.31; 'protocols': 0.31; 'probably': 0.32; 'standards': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '14,': 0.36; 'data,': 0.36; 'opposed': 0.36; 'sequence': 0.36; 'tight': 0.36; 'should': 0.36; 'problems': 0.38; 'easiest': 0.38; 'generic': 0.38; 'needed': 0.38; 'whatever': 0.38; 'either': 0.39; 'easy': 0.60; 'offer': 0.62; 'choose': 0.64; 'world': 0.66; 'internet': 0.71; 'serial': 0.72; 'goal': 0.75; 'awesome,': 0.84; 'borrow': 0.84; 'ideas.': 0.84; 'negotiate': 0.84; 'edwards': 0.91; 'to:none': 0.92; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=9AICDhKDkMwE+RZPIhluD3LKay4XI9wLPSbPL4XFobo=; b=XyOP8DqGx7Z40HlAj8070zNqzIhh/CF9HwEBwyO8zeXeHXyoUTzzPTcSsgDB/Ex1IX GuxR73p9Zl4kxg15SO7ivWjovFiY3FFtKZZEswCs8rQN2qw8KQuNpIYeIVrhsIUp57uw JVL5PG6vtM/MrcY+o2Mb66i0EUCQxUV/oZhLqUOWO1O3Qefyy1ILZgcrseG4tI9BkMJo hiZNo+lMtyzwmj19tdYZpsOCNub0Js5Ro2XH7Z4I2+49aDcoJVXv1nPsTEop+isq+CZS jV2Ft4Y/5fnRAP5ayrhVeDXB5tQWFmURnt8fdZZ1I8sZy3UC1VIAi+Hns1xVTalKTjlB 0nGA==
MIME-Version 1.0
X-Received by 10.68.236.233 with SMTP id ux9mr4456847pbc.45.1386954345350; Fri, 13 Dec 2013 09:05:45 -0800 (PST)
In-Reply-To <l8fe96$i0k$1@reader1.panix.com>
References <efae1b3c-c9c5-4ef4-8e94-7fbe8716ab53@googlegroups.com> <mailman.3939.1386804043.18130.python-list@python.org> <l8cggd$fl9$1@reader1.panix.com> <CAGGBd_oAG_fnrzBF4aAzpSB_BzFddGN02spg5gW9P_TUZb_YZA@mail.gmail.com> <mailman.4030.1386885532.18130.python-list@python.org> <l8fbi6$6q2$2@reader1.panix.com> <mailman.4074.1386951891.18130.python-list@python.org> <l8fe96$i0k$1@reader1.panix.com>
Date Sat, 14 Dec 2013 04:05:45 +1100
Subject Re: [newbie] trying socket as a replacement for nc
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4083.1386954348.18130.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386954348 news.xs4all.nl 2852 [2001:888:2000:d::a6]:46630
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61847

Show key headers only | View raw


On Sat, Dec 14, 2013 at 3:57 AM, Grant Edwards <invalid@invalid.invalid> wrote:
> On 2013-12-13, Chris Angelico <rosuav@gmail.com> wrote:
>> On Sat, Dec 14, 2013 at 3:10 AM, Grant Edwards <invalid@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.

Yeah, or if it's a tight binary protocol with occasional bits of
bigger payload, either MIDI or TELNET could offer ideas. MIDI's SysEx
message can carry whatever is needed of it, and TELNET has
subnegotiation that can be used for the odd thingy or so. But for a
generic binary stream-of-messages pipe (as opposed to the
stream-of-bytes pipe that TCP normally offers), probably the easiest
is to precede each write with an N-byte length... and somehow
negotiate what N should be. (And endianness, but hopefully that's just
network byte order.)

Standards are awesome, there are so many to choose from! http://xkcd.com/927/

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-11 15:08 -0800
  Re: [newbie] trying socket as a replacement for nc Dan Stromberg <drsalists@gmail.com> - 2013-12-11 15:20 -0800
    Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-12 00:28 -0800
      Re: [newbie] trying socket as a replacement for nc Dan Stromberg <drsalists@gmail.com> - 2013-12-12 13:23 -0800
        Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-12 19:23 -0800
          Re: [newbie] trying socket as a replacement for nc Dan Stromberg <drsalists@gmail.com> - 2013-12-12 19:32 -0800
            Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-13 03:03 -0800
            Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-13 03:56 -0800
          Re: [newbie] trying socket as a replacement for nc Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-13 08:35 +0000
            Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-13 04:20 -0800
              Re: [newbie] trying socket as a replacement for nc rusi <rustompmody@gmail.com> - 2013-12-13 09:04 -0800
              Re: [newbie] trying socket as a replacement for nc rusi <rustompmody@gmail.com> - 2013-12-13 09:09 -0800
                Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-14 05:11 -0800
            Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-14 05:14 -0800
              Re: [newbie] trying socket as a replacement for nc Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-14 13:29 +0000
        Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-16 01:40 -0800
          Re: [newbie] trying socket as a replacement for nc Ervin Hegedüs <airween@gmail.com> - 2013-12-16 11:04 +0100
    Re: [newbie] trying socket as a replacement for nc Grant Edwards <invalid@invalid.invalid> - 2013-12-12 14:16 +0000
      Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-13 01:23 +1100
      Re: [newbie] trying socket as a replacement for nc Dan Stromberg <drsalists@gmail.com> - 2013-12-12 13:27 -0800
        Re: [newbie] trying socket as a replacement for nc Grant Edwards <invalid@invalid.invalid> - 2013-12-13 16:06 +0000
          Re: [newbie] trying socket as a replacement for nc Dan Stromberg <drsalists@gmail.com> - 2013-12-14 17:24 -0800
            Re: [newbie] trying socket as a replacement for nc Grant Edwards <invalid@invalid.invalid> - 2013-12-15 15:15 +0000
              Re: [newbie] trying socket as a replacement for nc Roy Smith <roy@panix.com> - 2013-12-15 10:51 -0500
                Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-16 03:04 +1100
                Re: [newbie] trying socket as a replacement for nc Roy Smith <roy@panix.com> - 2013-12-15 12:44 -0500
                Re: [newbie] trying socket as a replacement for nc Grant Edwards <invalid@invalid.invalid> - 2013-12-15 22:42 +0000
                Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-16 09:48 +1100
      Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-13 08:58 +1100
        Re: [newbie] trying socket as a replacement for nc Grant Edwards <invalid@invalid.invalid> - 2013-12-13 16:10 +0000
          Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-14 03:19 +1100
            Re: [newbie] trying socket as a replacement for nc Grant Edwards <invalid@invalid.invalid> - 2013-12-13 16:57 +0000
              Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-14 04:05 +1100
        Re: [newbie] trying socket as a replacement for nc 88888 Dihedral <dihedral88888@gmail.com> - 2013-12-16 04:38 -0800
          Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-16 23:59 +1100
          Re: [newbie] trying socket as a replacement for nc Roy Smith <roy@panix.com> - 2013-12-16 09:03 -0500
            Re: [newbie] trying socket as a replacement for nc 88888 Dihedral <dihedral88888@gmail.com> - 2013-12-18 23:20 -0800
      Re: [newbie] trying socket as a replacement for nc Dave Angel <davea@davea.name> - 2013-12-12 19:52 -0500
  Re: [newbie] trying socket as a replacement for nc Conor Hughes <conorh@conorh.net> - 2013-12-11 15:38 -0800
    Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-12 00:08 -0800
      Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-12 19:21 +1100
        Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-12 01:21 -0800
          Re: [newbie] trying socket as a replacement for nc Alister <alister.ware@ntlworld.com> - 2013-12-12 14:05 +0000
          Re: [newbie] trying socket as a replacement for nc Alister <alister.ware@ntlworld.com> - 2013-12-12 14:05 +0000
            Re: [newbie] trying socket as a replacement for nc Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-12 14:34 +0000
  Re: [newbie] trying socket as a replacement for nc Christian Gollwitzer <auriocus@gmx.de> - 2013-12-13 00:43 +0100

csiph-web