newbie udp socket question
p@
digi at treepy.com
Sat May 10 20:13:25 EDT 2003
Hi list,
I have made the following UDP client:
class UdpClientSocket:
def __init__(self,address,port,request):
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.sendto(str(request),address)
response = sock.recv(port) #response here
command = response[0]
if command =='\x02':
print 'server is still alive'
if command =='\x04':
print 'server tcp queue accepted'
if command =='\x06':
print 'Member address recieved'
if command =='\x08':
print 'cluster update redirected'
sock.close()
udpc = UdpClientSocket(('localhost',serverPort),clientPort,'\x01')
The problem is if I don't get any response from the server it will block
forever. So how do I implement a timeout for this?
I have found a tcp-timeout-socket but none for udp...
Cheers
p@
More information about the Python-list
mailing list