Skip to main content
gamedev.net
🔒 Locked

Networking in python

Started by Chozabu Jun 30, 2006 at 7:05 AM 3 replies 950+ views
Original Post
Chozabu
Chozabu
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?
hplus0603
hplus0603
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 };
atomhamster
atomhamster
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
Chozabu
Chozabu
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
Kylotan
Kylotan
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.