FluentModbus icon indicating copy to clipboard operation
FluentModbus copied to clipboard

About Message Receive

Open tonyjianhu opened this issue 3 years ago • 1 comments

In Slave mode of the library, I can't seem to find a place to receive messages from the Master. For example, if the Master sends a request message with 03 function code, where can I receive it? I also want to be able to determine what function code the Master is requesting and what data it is receiving

tonyjianhu avatar Nov 18 '21 03:11 tonyjianhu

That's a valid question. You can control the response of the server using a validator function:

https://github.com/Apollo3zehn/FluentModbus/blob/master/doc/samples/modbus_validator.md/

However, there is no direct way to set the response data. You can only manipulate the server.GetHoldingRegisters() array (for example) from within the frame validation routine.

Apollo3zehn avatar Nov 18 '21 18:11 Apollo3zehn