socket.rcv timeout while-loop

Dwayne Blind dwayneblind at gmail.com
Fri Feb 4 09:55:33 EST 2011


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

2011/2/4 Jean-Michel Pichavant <jeanmichel at sequans.com>

> Stephen Hansen wrote:
>
>> On 2/3/11 9:56 AM, Dwayne Blind wrote:
>>
>>
>>> However I would like to set timeout on the socket rcv method, so that
>>> the while loop stops exactly after 3 seconds. Is this possible ?
>>>
>>>
>>
>> I rarely do low-level socket stuff -- [snip]
>>
>>
>>
> Good point. Python has a module for almost anything you would need to do on
> a network. Make sure none of these modules fit your needs.
> You could tell us what you want to achieve at a higher level, we may point
> you to a already existing module.
>
> Some of these modules are life saver, as I personnally always wrote buggy
> netcode for whatever reason :(
>
> JM
> --
>  http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110204/b0cf3c02/attachment-0001.html>


More information about the Python-list mailing list