set socket option SO_REUSEADDR to prevent "Address already in use" error
This commit is contained in:
parent
40a653f555
commit
a22a3cc0ea
|
@ -21,6 +21,7 @@ def do_request(connstream, from_addr):
|
||||||
|
|
||||||
def serve():
|
def serve():
|
||||||
bindsocket = socket.socket()
|
bindsocket = socket.socket()
|
||||||
|
bindsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
#bindsocket.bind(('localhost', PORT))
|
#bindsocket.bind(('localhost', PORT))
|
||||||
bindsocket.bind(('', PORT))
|
bindsocket.bind(('', PORT))
|
||||||
bindsocket.listen(5)
|
bindsocket.listen(5)
|
||||||
|
|
Loading…
Reference in New Issue