node-modbus-serial icon indicating copy to clipboard operation
node-modbus-serial copied to clipboard

debug should only output buffer received from TCP, not the generated CRC added to it

Open jedwards1211 opened this issue 5 years ago • 1 comments

servertcp appends a generated CRC to the buffer right before logging the data it received. This is misleading because it makes it look like the CRC was part of the data the client sent, but TCP clients don't send a CRC.

jedwards1211 avatar Jun 04 '20 07:06 jedwards1211

Looks like it needs the CRC because it passes it to the RTU code to process, which verifies the CRC. I suppose the quick fix is to move the code that adds the CRC to be after the debug statement, and the better fix is to parse the CRC outside the function so you don't need to append a CRC at all for data arriving via TCP.

Malvineous avatar Aug 30 '20 13:08 Malvineous