Advertisement

Networking in python

Started by June 30, 2006 07:05 AM
3 comments, last by Kylotan 18 years, 7 months ago
Hi all im looking at doing a simple little(real-time multiplayer) game mostly in python. but im at a bit of a stickey point... My requirements are(though im sure someone will tell me im wrong): server that runs main loop uninterupted server recognises each client uniquley client runs main loop uninterupted now, the clients kinda easy, i just have a non-blocking socket, and do stuff with it but the server is causing me a few headaches, i cant find a way to make "SocketServer" non-blocking (like, when im running my main loop, i cant check it for info without blocking the main loop) my current solution is to have a single socket on the server, and identify clients by their IP which aint a great solution tbh... what do you guys think?
If you're using UDP, then using a single socket, and identifying clients by IP address and port is The Way It Is Done. Note, though: using both IP and PORT of the client is very important for NAT compatibility!
enum Bool { True, False, FileNotFound };
Advertisement
hi,
i just read, that there is now a python binding for raknet. if you don't care about doing this yourself in python, you might be interested in this discussion:
http://www.rakkarsoft.com/raknet/forum/index.php?topic=651.0

cheers,
atom
greetings and such - atomhamster
OK, thanks for the replys!
yes, i am using UDP, glad to know what i am doing is at least close to the correct way
also, i am very intrested to hear that someone is making raknet bindings for python, and will check it out for sure
Getting one of the gaming networking libraries running under Python may well be a great idea. But failing that, look into the select module. It offers you functionality much like select does in C, and will report back to you on which sockets need handling and which ones don't.

This topic is closed to new replies.

Advertisement