Learning python networking

Chris Angelico rosuav at gmail.com
Wed Jan 15 10:36:06 EST 2014


On Wed, Jan 15, 2014 at 11:52 PM, Chris Angelico <rosuav at gmail.com> 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



More information about the Python-list mailing list