Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Accessing DataSocket Server with Python Date: Fri, 29 May 2015 16:29:26 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 38 Message-ID: References: NNTP-Posting-Host: 67-130-15-94.dia.static.qwest.net Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1432916966 18900 67.130.15.94 (29 May 2015 16:29:26 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Fri, 29 May 2015 16:29:26 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:91473 On 2015-05-29, William Ray Wing wrote: > While that’s certainly possible in a routed network (and even then > can be overridden with the “do not fragment” bit), it won’t happen in > a LAN or self-contained instrument set-up. You don't know that. > These days, even routed networks tend to deliver anything less than a > 1500 byte packet as a single entity. Doesn't matter. It can still happen in the network stack on either end. If you quickly call send() which small amounts of data, it's quite possible that the network stack will combine them into a single packet. Under some conditions this is done intentionally to reduce the overall network overhead. On the receiving end, if several small packets are received between calls to recv(), then a single call to recv() will return data from multiple packets. > With fiber backbones and high-speed LANs, it is more work for a > router to fragment a packet then to simply pass it on. The days of > 480 byte packets pretty much went away with dial-up modems. But modern TCP/IP stacks will still combine packets to save on network overhead. If you assume TCP read/write operations are atomic and "message" boundaries are preserved, your code is wrong. It will eventually fail. Period. -- Grant Edwards grant.b.edwards Yow! Inside, I'm already at SOBBING! gmail.com