Skip to content

Commit 30703dd

Browse files
authored
Merge pull request #323 from riptideio/#322-Reuse-Address
Fix for #322 allows reusing the address when running pymodbus synchronous server
2 parents 815e62a + af5d136 commit 30703dd

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ Version 1.5.0
4646
* Modbus read retries works only when empty/no message is received
4747
* Change test runner from nosetest to pytest
4848
* Fix Misc examples
49-
>>>>>>> master
5049

5150
Version 1.4.0
5251
------------------------------------------------------------

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)