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


Groups > comp.lang.python > #91481

Re: Accessing DataSocket Server with Python

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!newsfeed-00.mathworks.com!panix!not-for-mail
From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: Accessing DataSocket Server with Python
Date Fri, 29 May 2015 16:59:47 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 31
Message-ID <mka5u3$6c6$1@reader1.panix.com> (permalink)
References <CAO2fJ-+UjZNqo2yQRRkuSsEJwFAGOnbB9JPCCWX7zX7jt_5POg@mail.gmail.com> <CAGGBd_pEf0E6skDgzVuWLsPEX73OvpTkQ=CwgjKF6Yz+fC6bsw@mail.gmail.com> <mailman.181.1432910260.5151.python-list@python.org> <mka456$iek$1@reader1.panix.com> <mailman.196.1432917609.5151.python-list@python.org>
NNTP-Posting-Host 67-130-15-94.dia.static.qwest.net
X-Trace reader1.panix.com 1432918787 6534 67.130.15.94 (29 May 2015 16:59:47 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Fri, 29 May 2015 16:59:47 +0000 (UTC)
User-Agent slrn/1.0.1 (Linux)
Xref csiph.com comp.lang.python:91481

Show key headers only | View raw


On 2015-05-29, Chris Angelico <rosuav@gmail.com> wrote:
> On Sat, May 30, 2015 at 2:29 AM, Grant Edwards <invalid@invalid.invalid> wrote:
>
>> If you assume TCP read/write operations are atomic and "message"
>> boundaries are preserved, your code is wrong.  It will eventually
>> fail.  Period.
>
> Indeed. That said, though, if your writes are all smaller than one
> packet, and you perfectly alternate a write and a read, a write and a
> read, at both ends, then you can go a very long way without ever
> running into this.

That's true.  You probably won't see a failure until you do something
like run through some sort of WAN connection (satellite and PPP links
are excellent for exposing bad network code), or somebody configures a
switch, router, or IP interface in a goofy (but entire valid) way, or
somebody changes the app such that it writes more than 1500 bytes, or
it violates the strict alternation of reads/writes.

But someday, somehow, (IME) one of those always happens. And whoever
has to fix it will wish bad things upon you and your descendants.

I've lost count of the times I've had to fix somebody else's code that
broke because they assumed TCP was a datagram service rather than a
byte-stream service.

-- 
Grant Edwards               grant.b.edwards        Yow! UH-OH!!  I put on
                                  at               "GREAT HEAD-ON TRAIN
                              gmail.com            COLLISIONS of the 50's"
                                                   by mistake!!!

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


Thread

Re: Accessing DataSocket Server with Python William Ray Wing <wrw@mac.com> - 2015-05-29 09:37 -0400
  Re: Accessing DataSocket Server with Python Grant Edwards <invalid@invalid.invalid> - 2015-05-29 16:29 +0000
    Re: Accessing DataSocket Server with Python Chris Angelico <rosuav@gmail.com> - 2015-05-30 02:40 +1000
      Re: Accessing DataSocket Server with Python Grant Edwards <invalid@invalid.invalid> - 2015-05-29 16:59 +0000
      Re: Accessing DataSocket Server with Python Marko Rauhamaa <marko@pacujo.net> - 2015-05-29 20:21 +0300

csiph-web