sockets question

Mohammed Smadi smadim2 at grads.ece.mcmaster.ca
Sat Feb 26 00:35:57 EST 2005


hi;

i have the following piece of code:
=============
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind(("",port))
s.sendto(data,(MY_GW,port)) 
data = s.recvfrom(1024)  
============

data contains some instructions which i am sending to MY_GW.  If the 
reply arrives from the MY_GW quickly then things fine, otherwise the 
program is going to freeze waiting for the reply.  I want to do the 
following:

1- Be able to impose a timeout after which i want to stop executing 
the s.recvfrom statement.

rgds;
m.smadi




More information about the Python-list mailing list