Mercurial > touhou
diff pytouhou/network.py @ 477:e71b1bcf952a
Wait a bit for incoming messages...
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Wed, 28 Dec 2011 19:07:37 +0100 |
parents | 9d4d52793eca |
children | 884ca91b0854 |
line wrap: on
line diff
--- a/pytouhou/network.py +++ b/pytouhou/network.py @@ -12,14 +12,13 @@ class Network(object): self.remote_addr = dest self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) - self.sock.setblocking(0) self.sock.bind(('', port)) def read_messages(self): messages = [] - rlist, wlist, xlist = select([self.sock], [], [], 0) + rlist, wlist, xlist = select([self.sock], [], [], 1./60.) while rlist: msg, addr = rlist[0].recvfrom(MSG_STRUCT.size) # Check whether the message comes from the right address