Set the SO_REUSEADDR socket option in the server thread -- this seems

needed on some platforms (e.g. Solaris 8) when the test is run twice
in quick succession.
This commit is contained in:
Guido van Rossum 2001-04-15 00:42:13 +00:00
parent 3fee30407e
commit f3ee46b82a

View File

@ -10,6 +10,7 @@ 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))
sock.listen(1)
conn, client = sock.accept()