Closed OrangeTux closed 8 years ago
For testing a Modbus server is created using modbus-tk. Under some circumstances the server stops working with this message:
2015-11-19 11:09:50,260 ERROR modbus_tcp._send Thread-14 Error while flushing the socket: flush_socket: maximum number of iterations reached
I've tried to get around it, but I couldn't. I think this is a bug in modbus-tk and not in Tolk. Because soon we'll replace modbus-tk and with uModbus I don't want to put more effort in it to fix it. Mark the test as with @pytest.mark.xfail
to ignore the failure for now.
I guess test will pass again when we switched to uModbus.
Currently when a Modbus server returns an Modbus error code, Tolk returns a JSON-RPC error with code -32603: Internal JSON-RPC error containing the stacktrace. Response below fails with Modbus exception code 2: Illegal Data Address.
The JSON-RPC specification leaves room for custom errors. Below the surface Tolk uses Modbus-TK which implements 7 Modbus error codes. Tolk should return custom JSON-RPC errors reflecting the Modbus error code that was returned. Tolk should implement the following error codes:
An error response now could look like this: