From a22a3cc0ea18e3006ace279c54a08d23c9c941e1 Mon Sep 17 00:00:00 2001 From: Amir Malik Date: Tue, 21 Dec 2010 10:11:15 +0800 Subject: [PATCH] set socket option SO_REUSEADDR to prevent "Address already in use" error --- utils/web.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/web.py b/utils/web.py index 80d11d55..6b7670b0 100755 --- a/utils/web.py +++ b/utils/web.py @@ -21,6 +21,7 @@ def do_request(connstream, from_addr): def serve(): bindsocket = socket.socket() + bindsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) #bindsocket.bind(('localhost', PORT)) bindsocket.bind(('', PORT)) bindsocket.listen(5)