[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Networking?



On 11/21/07, Chris Ashurst <CAshurst@xxxxxxxx> wrote:
> I hope you mean that the sockets library is not the place to start, simply
> because it's not immediately easy (unlike Twisted) to get right into? I
> believe every programmer who wants to use a higher-level library should at
> least have a stab at the low-level stuff, just to give a better idea of
> what's going on behind the automagical scenese of things like Twisted

What I meant is that to accomplish something usefull using the sockets
library, you have to build higher level systems, and you end up
reinventing asyncore or Twisted.   Reinventing sucks.

> Rather than haul in Twisted, a little research on the Python select module
> could be the very thing people are looking for - all without having any
> extra dependencies/includes other than the core Python library and Pygame.

To each their own, but I consider additional pure-python dependencies
to be a non-issue.  If including an extra 100K of library code saves
me a couple hours of work, I am all for it.   Non-pure-python
dependencies are an issue, because they may not build on the users
machine.

> http://www.amk.ca/python/howto/sockets/
> <http://www.amk.ca/python/howto/sockets/ - > - the Non-blocking Sockets
> section is particularly enlightening

This is actually the document I would refer people to, to scare them
away from socket programming. ;)

Quotes:

 # This is a 10,000 foot overview of sockets. It's not really a
tutorial - you'll still have
 # work to do in getting things operational. It doesn't cover the fine
points (and there
 # are a lot of them), but I hope ...

 # There's no question that the fastest sockets code uses non-blocking sockets
 #  and select to multiplex them. ... The trouble is that an  app
written this way
 #  can't do much of anything else - it needs to be ready to shuffle
bytes around at
 # all times.

That document was written in the mid 1990's, and the state of
networking in Python has advanced since then.

As a matter of context, this is a Pygame mailing list, and presumably
list-members are interested in getting their game complete and robust.
 A networking library is just a tool to getting the cool game-state
from this server to that client (and client events back to the
server), not a contributer to game-state coolness.  No disrespect to
socket-twiddlers, and I get the impression the original poster may be
one himself, but many on the list are interested in easy toolkits to
just "get 'er done".

David

-- 
dkeeney@xxxxxxxxxxxxxxxx
Pitcher's Duel -> pitchersduel.python-hosting.com