looking for UDP package, network programming guidance

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Mon Jul 7 20:05:48 CEST 2003


Tom Plunket wrote:

> running, but now the stumbling block comes up that Python doesn't
> seem to have any UDP handling built into its distribution.

You didn't look hard enough. Check out the SocketServer module:
http://www.python.org/doc/current/lib/module-SocketServer.html

Also, what *exactly* do you mean by "UDP handling"?
Python is perfectly capable of creating and using sockets
for the TCP *and* UDP protocols.

> Additionally, the networking protocol is a fixed format packed
> bytes sort of thing; is it easy enough in Python (with Twisted)
> to read bytes off of the stream and then decide what to do with
> them?  (I'm a Python newbie but somewhat of a C++ pro.)

It should be fairly easy to decypher the binary protocol using
the array or struct modules:
http://www.python.org/doc/current/lib/module-array.html
http://www.python.org/doc/current/lib/module-struct.html

You might also want to read the Python-socket-programming-howto:
http://www.amk.ca/python/howto/sockets/sockets.html

I generally find it much easier to do network/socket related
stuff in Python than in other languages such as C or Java.

If you still encounter difficulties, don't hesitate to post!

--Irmen de Jong






More information about the Python-list mailing list