sock-server.py: Use SO_REUSEADDR to avoid errors on quick restart.
This commit is contained in:
parent
a88c30c64a
commit
4795c58f3c
|
@ -16,6 +16,7 @@ ai = socket.getaddrinfo("127.0.0.1", 8080)
|
||||||
print("Bind address info:", ai)
|
print("Bind address info:", ai)
|
||||||
addr = ai[0][4]
|
addr = ai[0][4]
|
||||||
|
|
||||||
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
s.bind(addr)
|
s.bind(addr)
|
||||||
s.listen(5)
|
s.listen(5)
|
||||||
print("Listening, connect your browser to http://127.0.0.1:8080/")
|
print("Listening, connect your browser to http://127.0.0.1:8080/")
|
||||||
|
|
Loading…
Reference in New Issue