mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Don't fail if another process is listening on our port.
This commit is contained in:
parent
7ca6677218
commit
62bc8aadd4
1 changed files with 2 additions and 1 deletions
|
|
@ -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 = ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue