git » pymisc » commit ba9729b

pickle_rpc: Allow socket reuse

author Alberto Bertogli
2008-10-29 14:23:01 UTC
committer Alberto Bertogli
2008-10-29 14:23:01 UTC
parent f46974b5a89eec73762e80a99fe92546871b4748

pickle_rpc: Allow socket reuse

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

pickle_rpc.py +2 -0

diff --git a/pickle_rpc.py b/pickle_rpc.py
index eebc0bb..702f1e0 100644
--- a/pickle_rpc.py
+++ b/pickle_rpc.py
@@ -80,6 +80,8 @@ class Server (object):
 	def __init__(self, ip, port = default_port):
 		self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 		self.sock.bind((ip, port))
+		self.sock.setsockopt(socket.SOL_SOCKET, \
+				socket.SO_REUSEADDR, 1)
 		self.fds = []
 		self.functions = {}