Question about null modem support with sync clients #2994
|
The documentation states that the internal null modem works with all sync and async servers and clients:
I am able to connect an The error with the sync client happens when I call connect looks like this: client = ModbusTcpClient(host=NULLMODEM_HOST)
client.connect()
# log message: ERROR tcp:201 Connection to (__pymodbus_nullmodem, 502) failed: [Errno 11001] getaddrinfo failed.
# pymdobus.exceptions.ConnectionException: Modbus Error: [Connection] failed to connect[ModbusTcpClient __pymodbus_nullmodem:502]I wanted to ask if the documentation for the null modem is up-to-date. In the pymodbus tests I noticed that Code sample: import threading
from pymodbus.client import ModbusTcpClient
from pymodbus.server import ServerStop, StartTcpServer
from pymodbus.simulator import DataType, SimData, SimDevice
from pymodbus.transport import NULLMODEM_HOST
thread = threading.Thread(
target=StartTcpServer,
args=(SimDevice(1, [SimData(0, 100, 0, DataType.INT16)]),),
kwargs={"address": (NULLMODEM_HOST, 502)})
thread.start()
client = ModbusTcpClient(host=NULLMODEM_HOST, port=502)
try:
client.connect()
result = client.read_holding_registers(0, count=5, device_id=1)
finally:
client.close()
ServerStop()
thread.join() |
Replies: 1 comment 2 replies
|
It's a bug in the documentation, only async is supported... which makes sense since the server is async. Nullmodem is or at least was implemented in the sync client, but only to be used for some special performance tests. Doc should be corrected. |
It's a bug in the documentation, only async is supported... which makes sense since the server is async.
Nullmodem is or at least was implemented in the sync client, but only to be used for some special performance tests.
Doc should be corrected.