Skip to content

Commit af5d136

Browse files
committed
#322 allow reusing of server address
1 parent c303e33 commit af5d136

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pymodbus/server/sync.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ class ModbusTcpServer(socketserver.ThreadingTCPServer):
273273
"""
274274

275275
def __init__(self, context, framer=None, identity=None,
276-
address=None, handler=None, **kwargs):
276+
address=None, handler=None, allow_reuse_address=False,
277+
**kwargs):
277278
""" Overloaded initializer for the socket server
278279
279280
If the identify structure is not passed in, the ModbusControlBlock
@@ -285,10 +286,13 @@ def __init__(self, context, framer=None, identity=None,
285286
:param address: An optional (interface, port) to bind to.
286287
:param handler: A handler for each client session; default is
287288
ModbusConnectedRequestHandler
289+
:param allow_reuse_address: Whether the server will allow the
290+
reuse of an address.
288291
:param ignore_missing_slaves: True to not send errors on a request
289292
to a missing slave
290293
"""
291294
self.threads = []
295+
self.allow_reuse_address = allow_reuse_address
292296
self.decoder = ServerDecoder()
293297
self.framer = framer or ModbusSocketFramer
294298
self.context = context or ModbusServerContext()

0 commit comments

Comments
 (0)