Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: UNSURE 0.399 X-Spam-Level: *** X-Spam-Evidence: '*H*': 0.28; '*S*': 0.07; 'socket': 0.07; 'cc:addr :python-list': 0.11; 'jan': 0.12; 'disconnect': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'half.': 0.16; 'through.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'minutes.': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; '15,': 0.26; 'header :In-Reply-To:1': 0.27; 'chris': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'period': 0.33; 'actual': 0.34; "can't": 0.35; 'connection': 0.35; 'received:google.com': 0.35; 'half': 0.37; 'server': 0.38; 'thank': 0.38; 'connections': 0.38; 'mine': 0.38; 'handle': 0.38; 'pm,': 0.38; 'previous': 0.38; "couldn't": 0.39; 'extremely': 0.39; 'users': 0.40; 'easy': 0.60; 'solve': 0.60; 'hope': 0.61; 'introduced': 0.61; 'back': 0.62; 'times': 0.62; 'such': 0.63; 'different': 0.65; 'phone': 0.66; 'minutes': 0.67; 'hang': 0.67; 'gathering': 0.68; 'internet': 0.71; 'music': 0.75; 'yourself': 0.78; 'protect': 0.79; 'friend': 0.79; 'transfer': 0.82; 'battery': 0.84; 'break.': 0.84; 'cordless': 0.84; 'frustrating': 0.84; "it'd": 0.84; 'off,': 0.84; 'sitting': 0.91; 'to:none': 0.92; 'connection,': 0.95 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=V+2HEWQiq/N1MQ1HOjTjJFV8KwjbhhRy3UPeWDYYwVw=; b=Vam+glplscgJjVWsk9RBO+mAv9Q7ReoPN1ziu8HzpvvG58hoNuL3T5SoHrU4C8ZZct S9EBPQwRKPzUDumE8WawkayB8512gzAFps52pdKzfP52cg9iT8pYU4PLjpxCZ7pS/vz+ fZ1dBqRCIiz1LTXIKPJjH9DP7d4MYwPCpyDcOXN28V710MwTR5W5mHQVMnxGoe5hORRB HLp6GbYiz+dHy7RrAwo7e7gVdTGbU1HNxfzXy+nd0KgQeH0KnGCJ80/c50qzzuZ2yQwe 4XRgVMGSn+m3r+n3h0fOZ+tIS/2D92/Q03bnvac/j67Kfd1vGKTm/dJKJD87ACd7Rp6V iYOg== MIME-Version: 1.0 X-Received: by 10.68.133.6 with SMTP id oy6mr3421235pbb.153.1389800166201; Wed, 15 Jan 2014 07:36:06 -0800 (PST) In-Reply-To: References: <22d58d76-f2c2-4a1d-8049-3409ac4665d3@googlegroups.com> <9202d352-e065-4f2b-a9e0-e29ce5c68df6@googlegroups.com> Date: Thu, 16 Jan 2014 02:36:06 +1100 Subject: Re: Learning python networking From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-Mailman-Approved-At: Wed, 15 Jan 2014 16:36:54 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389800216 news.xs4all.nl 2938 [2001:888:2000:d::a6]:55785 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63992 On Wed, Jan 15, 2014 at 11:52 PM, Chris Angelico wrote: > One of the fundamentals of the internet is that connections *will* > break. A friend of mine introduced me to Magic: The Gathering via a > program that couldn't handle drop-outs, and it got extremely > frustrating - we couldn't get a game going. Build your server such > that your clients can disconnect and reconnect, and you protect > yourself against half the problem; allow them to connect and kick the > other connection off, and you solve the other half. Case in point, and a very annoying one: Phone queues do NOT handle drop-outs. There's no way to reconnect to the queue and resume your place, you have to start over from the back of the queue. I'm currently on hold to my ISP because of an outage, and the cordless phone ran out of battery 27 minutes into an estimated 30-minute wait time. (Though I suspect it'd be a lot longer than 30 minutes. Those wait times are notoriously inaccurate.) So now I'm waiting, AGAIN, and those previous 27 minutes of sitting around with their on-hold music playing through speakerphone were of no value whatsoever. I can't transfer to a different handset or connection, I have to just hope that this one will get through. With TCP-based servers, it's easy to do better than that - all you have to do is separate the connection state from the actual socket, and hang onto a "connection" for some period of time after its socket disconnects (say, 10-15 minutes). Your users will thank you! ChrisA