[Tutor] socket timeout
stefan at lsd.co.za
Fri Nov 27 08:45:56 CET 2009
Maybe someone can point me in the right direction, since i'm not sure why i cant get the timeout to work. Admittedly i don't know much about socket programming.
Im using the below code...
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
As the code is above, it works (with the timeout commented out), when i leave the uncomment the setdefaulttimeout, the code doesnt even seem to connect. I've played with various values (1, 5, 500 etc)
The problem essentially occurs when i connect to a server where a firewall drops the packet. It seems to wait really long before moving on, i would like the timeout to kick in after 10secs or so to continue. Im also not sure if this is a good way to check if a ip,port is available.
Thanks in advance
More information about the Tutor