]> granicus.if.org Git - python/commitdiff
Don't fail if another process is listening on our port.
authorNeal Norwitz <nnorwitz@gmail.com>
Tue, 13 Jun 2006 04:08:53 +0000 (04:08 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Tue, 13 Jun 2006 04:08:53 +0000 (04:08 +0000)
Lib/test/test_asynchat.py

index f93587acbef2747961fba74b1379308293a14d62..99261679673117934fd6397a18f644b8cdedb235 100644 (file)
@@ -13,7 +13,8 @@ class echo_server(threading.Thread):
     def run(self):
         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-        sock.bind((HOST, PORT))
+        global PORT
+        PORT = test_support.bind_port(sock, HOST, PORT)
         sock.listen(1)
         conn, client = sock.accept()
         buffer = ""