socket.connect blocks main thread?

Darrell dgallion1 at yahoo.com
Mon Feb 11 19:24:01 EST 2002


On Win2k s.connect blocks the printing of '.' while it times out.
Not what I expected, any ideas?
If sourceforge is wasn't soooo slow right now, I'd take a look.
--Darrell

import socket, time, thread

def getIpConnThread(self):
    while 1:
        time.sleep(3)
        host='localhostxxx'
        try:
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.connect((host,2000))
        except:
            print 'Failed to connect to:',host
        
thread.start_new_thread(getIpConnThread, (None,))
while 1:
    time.sleep(0.5)
    print '.',



More information about the Python-list mailing list