Re: socket.rcv timeout while-loop

2011-02-07 Thread Dwayne Blind
Dear Stephen, Thanks for telling me this all looked very peculiar. As you said, it did not really need solving. Cheers, Dwayne 2011/2/4 Stephen Hansen > On 2/4/11 9:16 AM, Dwayne Blind wrote: > > @ Stephen Hansen > > Now I am pretty much worried. :'( > > Why? T

Re: socket.rcv timeout while-loop

2011-02-04 Thread Dwayne Blind
Thank you very much Jean-Michel Pichavant and Stephen Hansen. @ Jean-Michel Pichavant I will have a look at Pyro. @ Stephen Hansen Now I am pretty much worried. :'( 2011/2/4 Stephen Hansen > On 2/4/11 6:55 AM, Dwayne Blind wrote: > > @ Jean-Michel Pichavant > >

Re: socket.rcv timeout while-loop

2011-02-04 Thread Dwayne Blind
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 > Stephen Hansen wrote: > >> On 2/3/11 9:56

Re: socket.rcv timeout while-loop

2011-02-03 Thread Dwayne Blind
2/4 Dwayne Blind > The solution would be > > > timeout = s.gettimeout() > s.settimeout(3) > b=time.clock() > while time.clock()-b<3 : >try : >data=s.recv(1024) > except : >break >

Re: socket.rcv timeout while-loop

2011-02-03 Thread Dwayne Blind
The solution would be timeout = s.gettimeout() s.settimeout(3) b=time.clock() while time.clock()-b<3 : try : data=s.recv(1024) except : break s.settimeout(timeout) Am I right ? Dwayne 2011/2/4 Dwayne Blind >

Re: socket.rcv timeout while-loop

2011-02-03 Thread Dwayne Blind
Stephen Hansen > On 2/3/11 10:13 AM, Dwayne Blind wrote: > > Thanks for your answer. I don't want to reset my socket. I want to apply > > the timeout to the rcv method only. > > Setting the timeout does not "reset [your] socket", I don't think. And I > ge

Re: socket.rcv timeout while-loop

2011-02-03 Thread Dwayne Blind
Thanks for your answer. I don't want to reset my socket. I want to apply the timeout to the rcv method only. What about select ? http://docs.python.org/library/select.html#select.select How to implement it ? Thanks a lot, Dwayne 2011/2/3 Stephen Hansen > On 2/3/11 9:56 AM, Dway

socket.rcv timeout while-loop

2011-02-03 Thread Dwayne Blind
Hi everybody, I am using Python 3.0. I have such a code : b=time.clock() while time.clock()-b<3 : data=s.recv(1024) 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 ? Thanks a lot, Dwayne -- http://mail.pyt