Checking if port is in use.

elbertlev at hotmail.com elbertlev at hotmail.com
Sat Mar 19 16:45:53 CET 2005


How about this?

try:
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1)
    s.bind((HOST, PORT))
except socket.error, e:
    if e....
        print "address already in use"




More information about the Python-list mailing list