digitalpetri / modbus

Modbus TCP, Modbus RTU/TCP, and Modbus RTU/Serial for Java 17+.
Eclipse Public License 2.0
654 stars 222 forks source link

How to configure the server slave id #16

Closed pintify closed 7 years ago

pintify commented 7 years ago

I have followed the simple slave configuration and been working on improving it towards my project needs. However I have been unable to configure the slave ID, how can it be done? I am trying to achieve that the slave does not answer when the slave ID does not match the one I am requesting.

kevinherron commented 7 years ago

Check ServiceRequest#getUnitId in your handler. Unit ID and Slave ID are the same thing.

pintify commented 7 years ago

Oh, OK, I was looking for that on configuration time, instead of in the handler. Anyway, it worked perfectly. Thank you!

kevinherron commented 7 years ago

👍