From 2b136ee0883b2035d4c83a85930c4f63f53a2a40 Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Tue, 28 Mar 2017 12:54:21 -0400 Subject: [PATCH] allow a host parameter as well as a port parameter for listening on specific address --- modpypes/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modpypes/app.py b/modpypes/app.py index bb55e0d..cc64d79 100644 --- a/modpypes/app.py +++ b/modpypes/app.py @@ -150,13 +150,13 @@ class ModbusClient(Client, Server): @bacpypes_debugging class ModbusServer(Client, Server): - def __init__(self, port=502, **kwargs): - if _debug: ModbusServer._debug("__init__ port=%r %r", port, kwargs) + def __init__(self, host='', port=502, **kwargs): + if _debug: ModbusServer._debug("__init__ host=%r port=%r %r", host, port, kwargs) Client.__init__(self) Server.__init__(self) # create and bind - self.serverDirector = TCPServerDirector(('', port), **kwargs) + self.serverDirector = TCPServerDirector((host, port), **kwargs) bind(self, StreamToPacket(stream_to_packet), self.serverDirector) def confirmation(self, pdu):