@@ -148,76 +148,76 @@ async def run_server(args=None):
148148
149149 _logger .info ("### start server" )
150150 if server_id == "tcp" :
151- server = StartTcpServer (
151+ server = await StartTcpServer (
152152 context = store , # Data storage
153153 identity = identity , # server identify
154154 # TBD host=
155155 # TBD port=
156- address = ("" , port ), # listen address
157- custom_functions = [], # allow custom handling
156+ address = ("127.0.0.1 " , port ), # listen address
157+ # custom_functions=[], # allow custom handling
158158 framer = framer , # The framer strategy to use
159- handler = None , # handler for each session
159+ # handler=None, # handler for each session
160160 allow_reuse_address = True , # allow the reuse of an address
161- ignore_missing_slaves = True , # ignore request to a missing slave
162- broadcast_enable = False , # treat unit_id 0 as broadcast address,
161+ # ignore_missing_slaves=True, # ignore request to a missing slave
162+ # broadcast_enable=False, # treat unit_id 0 as broadcast address,
163163 # TBD timeout=1, # waiting time for request to complete
164164 # TBD strict=True, # use strict timing, t1.5 for Modbus RTU
165165 defer_start = defer_start # Only define server do not activate
166166 )
167167 elif server_id == "udp" :
168- server = StartUdpServer (
168+ server = await StartUdpServer (
169169 context = store , # Data storage
170170 identity = identity , # server identify
171- address = ("" , port ), # listen address
172- custom_functions = [], # allow custom handling
171+ address = ("127.0.0.1 " , port ), # listen address
172+ # custom_functions=[], # allow custom handling
173173 framer = framer , # The framer strategy to use
174- handler = None , # handler for each session
174+ # handler=None, # handler for each session
175175 # TBD allow_reuse_address=True, # allow the reuse of an address
176- ignore_missing_slaves = True , # ignore request to a missing slave
177- broadcast_enable = False , # treat unit_id 0 as broadcast address,
176+ # ignore_missing_slaves=True, # ignore request to a missing slave
177+ # broadcast_enable=False, # treat unit_id 0 as broadcast address,
178178 # TBD timeout=1, # waiting time for request to complete
179179 # TBD strict=True, # use strict timing, t1.5 for Modbus RTU
180180 defer_start = defer_start # Only define server do not activate
181181 )
182182 elif server_id == "serial" :
183183 # socat -d -d PTY,link=/tmp/ptyp0,raw,echo=0,ispeed=9600 PTY,
184184 # link=/tmp/ttyp0,raw,echo=0,ospeed=9600
185- server = StartSerialServer (
185+ server = await StartSerialServer (
186186 context = store , # Data storage
187187 identity = identity , # server identify
188- timeout = 0.005 , # waiting time for request to complete
188+ # timeout=0.005, # waiting time for request to complete
189189 port = port , # serial port
190- custom_functions = [], # allow custom handling
190+ # custom_functions=[], # allow custom handling
191191 framer = framer , # The framer strategy to use
192- handler = None , # handler for each session
193- stopbits = 1 , # The number of stop bits to use
194- bytesize = 8 , # The bytesize of the serial messages
195- parity = "N" , # Which kind of parity to use
196- baudrate = 9600 , # The baud rate to use for the serial device
197- handle_local_echo = False , # Handle local echo of the USB-to-RS485 adaptor
198- ignore_missing_slaves = True , # ignore request to a missing slave
199- broadcast_enable = False , # treat unit_id 0 as broadcast address,
200- strict = True , # use strict timing, t1.5 for Modbus RTU
192+ # handler=None, # handler for each session
193+ # stopbits=1, # The number of stop bits to use
194+ # bytesize=8, # The bytesize of the serial messages
195+ # parity="N", # Which kind of parity to use
196+ # baudrate=9600, # The baud rate to use for the serial device
197+ # handle_local_echo=False, # Handle local echo of the USB-to-RS485 adaptor
198+ # ignore_missing_slaves=True, # ignore request to a missing slave
199+ # broadcast_enable=False, # treat unit_id 0 as broadcast address,
200+ # strict=True, # use strict timing, t1.5 for Modbus RTU
201201 defer_start = defer_start # Only define server do not activate
202202 )
203203 elif server_id == "tls" :
204- server = StartTlsServer (
204+ server = await StartTlsServer (
205205 context = store , # Data storage
206206 host = "localhost" , # define tcp address where to connect to.
207- port = port , # on which port
207+ # port=port, # on which port
208208 identity = identity , # server identify
209- custom_functions = [], # allow custom handling
209+ # custom_functions=[], # allow custom handling
210210 address = ("" , 5020 ), # listen address
211211 framer = framer , # The framer strategy to use
212- handler = None , # handler for each session
212+ # handler=None, # handler for each session
213213 allow_reuse_address = True , # allow the reuse of an address
214- certfile = None , # The cert file path for TLS (used if sslctx is None)
215- sslctx = None , # The SSLContext to use for TLS (default None and auto create)
216- keyfile = None , # The key file path for TLS (used if sslctx is None)
217- password = None , # The password for for decrypting the private key file
218- reqclicert = False , # Force the sever request client"s certificate
219- ignore_missing_slaves = True , # ignore request to a missing slave
220- broadcast_enable = False , # treat unit_id 0 as broadcast address,
214+ # certfile=None, # The cert file path for TLS (used if sslctx is None)
215+ # sslctx=None, # The SSLContext to use for TLS (default None and auto create)
216+ # keyfile=None, # The key file path for TLS (used if sslctx is None)
217+ # password=None, # The password for for decrypting the private key file
218+ # reqclicert=False, # Force the sever request client"s certificate
219+ # ignore_missing_slaves=True, # ignore request to a missing slave
220+ # broadcast_enable=False, # treat unit_id 0 as broadcast address,
221221 # TBD timeout=1, # waiting time for request to complete
222222 # TBD strict=True, # use strict timing, t1.5 for Modbus RTU
223223 defer_start = defer_start # Only define server do not activate
0 commit comments