Replies: 2 comments 3 replies
-
Our server currently only allows one unit id, this is due to a global structure. It should ideally be for each slave id. Feel free to to raise an issue, but it is unlikely to be solved anytime soon, so much better if you submit a PR. |
Beta Was this translation helpful? Give feedback.
-
For testing purpose I modified execute in async_io.py to: if self.server.request_tracer:
- self.server.request_tracer(request, *addr)
+ self.server.request_tracer(request, *addr, peer=self.transport.get_extra_info('peername')) and added a request_tracer def test(request, *addr, **kwargs):
pprint(kwargs)
master = await StartAsyncTcpServer(
context=server_context,
identity=identity,
address=('192.168.10.10', 5020),
framer=ModbusSocketFramer,
request_tracer=test,
) The output now shows the peer IP:
At the moment I think the easiest and smallest change would be to modify the request and replace the uid with the peer IP and overwrite the validation in |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to start an TCP server with more than one slave context.
On one slave I am able to configure the unit identifier, but another one looks like it follows modbus messaging implementation guide and therefor it sends messages with unit identifier 255.
I cannot create a slave to the server context with id 255, because the server context validates that the slave id is between 1 and 247.
I could overwrite the validation, but what happens if I have a second slave following this implementation? I cannot distinguish between them.
As stated below, the uid is useless on TCP. So I would suggest to use the source IP as slave id, but I am somehow unable to understand the socket frame to replace uid in the header with the source IP and circumvent all validations.
Can anyone help? Should I create an issue for that?
From the modbus messaging implementation guide:
Beta Was this translation helpful? Give feedback.
All reactions