Adding socket option to server socket to bind to port in use to make restarts faster and more consistent
This commit is contained in:
@@ -30,6 +30,8 @@ FORMAT = 'utf-8'
|
|||||||
DISCONNECT_MESSAGE = "!DISCONNECT"
|
DISCONNECT_MESSAGE = "!DISCONNECT"
|
||||||
|
|
||||||
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
server.bind(ADDR)
|
server.bind(ADDR)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
|
|||||||
Reference in New Issue
Block a user