socket.rcv timeout while-loop

Jean-Michel Pichavant jeanmichel at sequans.com
Fri Feb 4 10:31:15 EST 2011


Dwayne Blind wrote:
> Thanks to all of you.
>  
> @ Jean-Michel Pichavant
> I am writing a small multiplayer game. Several clients are connected 
> to the server. Games last, say, 20 seconds.
> You can think of the game as a small chat lasting 20 seconds. All the 
> data received by the server is sent back to the clients.
>  
> @ Stephen Hansen
> Each player can send as many words as he wants. I think this is why I 
> need the loop. Don't you think so ?
>  
> @ Dave Angel
> s = conn, with conn,address=socket.accept()
> (see Socket Objects)
>  
> Thanks again
Please do not Top post :)

xmlrpclib and Pyro are for example 2 modules that could have taken care 
of your netcode. In your case, Pyro could be perfect for you since it 
has no constraint (basically the  xmlrpc protocol).

Quoting Pyro's home page:

"Never worry about writing network communication code again, when using 
Pyro you just write your Python objects like you would normally. With 
only a few lines of extra code, Pyro takes care of the network 
communication between your objects once you split them over different 
machines on the network. All the gory socket programming details are 
taken care of, you just call a method on a remote object as if it were a 
local object!".

See the examples to get  better idea of remote calls with pyro.

JM









More information about the Python-list mailing list