Skip to main content

parse_response

Function parse_response 

Source
pub fn parse_response(
    pdu: &[u8],
    request: &ModbusRequest,
) -> Result<ModbusResponse, String>
Expand description

Decode a response PDU against the request it answers.

Every field the specification fixes is checked, because a response that disagrees with its request is a server answering a different question: the function code (or its exception form), the byte count against the quantity asked for, the PDU length against the byte count, and a write’s acknowledgement against what was written. The error says which.