Fix small issue in Write File Record server response
According to the official MODBUS protocol documentation the normal response of a Write File Record request is an echo of the request. The whole request including the records data must be included in the response. This pull request makes sure the whole request is send as a response.
Link to the MODBUS documentation for reference: https://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf
At the moment the buffer index is set to the end of the PDU, so that send_msg() re-transmits the request as it was received, and it looks ok. What does the PR change?
That's a very good question. I don't remember why I did that. Why does it work in both occasions, though?