Apollo3zehn / FluentModbus

Lightweight and fast client and server implementation of the Modbus protocol (TCP/RTU).
MIT License
211 stars 72 forks source link

How can I set the unitIdentifier of a rtu server to 255? #57

Closed DinoFive closed 2 years ago

DinoFive commented 2 years ago

I know the specification limits server address to 1-247, but I am working on a non-standard MODBUS system which require a server response to a request with address of 255. Is it possible with FluentModbus?

Apollo3zehn commented 2 years ago

Are you using version 3 or version 4 (preview)? I would like to know if I would need to backport the required changes. My idea is to make the limits configurable so that users can deliberately override the standard behavior. I would make the changes next week, until then maybe you could use reflection. In case of v3.x.x, you would need to set the private field _unitIdentifier of the ModbusRtuServer. Here is an example how to accomplish this (untested): https://stackoverflow.com/questions/12993962/set-value-of-private-field

DinoFive commented 2 years ago

I'm using v3.2.1. Using reflection works for me. Thanks a lot.