Comments (10)
If I understand you correctly the validate_crc
of a response failes? Could you post a stacktrace/error?
from umodbus.
Hi! Thanks for responding.
I can dig up the exception, but it has to do with the fact that write_multiple_registers() is expecting a response and when it times out, it still calls validate_crc() with an empty buffer, which then gives the exception. Should I trap for that and then handle exceptions that way?
Do you still need a stack trace or is that expected behavior?
from umodbus.
I understand the case and I agree that the raising the exception in validate_crc
is a bit weird. Earlier in the process an error should be raised.
def send_message(adu, serial_port):
""" Send Modbus message over serial port and parse response. """
serial_port.write(adu)
response = serial_port.read(serial_port.in_waiting)
if len(response) == 0:
raise TimeoutError
return parse_response_adu(response, adu)
from umodbus.
from umodbus.
If you want to fix it I'm happy to receive a pull request.
from umodbus.
from umodbus.
Good finding. I don't think that validate_crc
is a proper place to do the length check. What would be
good error tho raise in this place and how should both rtu client and server handle it?
I think rtu.RTUServer.serve_once
should check if length of request_adu. If length is 0 the method must not return the try to process the request and return a response, like you said, but it should raise an error. I think a TimeoutError fits best.
from umodbus.
Hi there,
Is this issue is still unsolved?
from umodbus.
No, it isn't yet. But the solution already thought trough in the above comments. So it's very easy to implement. I'll try to fix in somewhere this week.
from umodbus.
This has been fixed in the 1.0.0
from umodbus.
Related Issues (20)
- TCP Server Modbus Timeout after disconnect and reconnect after some time. HOT 2
- Read Multiple Hosts HOT 2
- ServerDeviceFailureError: An unrecoverable error occurred. HOT 6
- How do you access the raw (bytes) response for decoding messages that aren't composed of 16-bit integers? HOT 2
- RTU client does not respect inter-frame delay
- uModbus on Raspberry Pi
- Duplicate statement at lines 1519-1520 in functions.py : self._values = values
- Online uModbus tcp server HOT 2
- tcp.write_multiple_registers command is unable to write more than 3 registers, in modbus TCP HOT 2
- How to stop server from example code? HOT 2
- Import Error: no module named 'logging' HOT 1
- Possible typo in functions.py HOT 4
- disable all error
- illegalDataAddressError while writing single or multiple registers TCP HOT 1
- Multiple slaves with RTU HOT 8
- Can i control if single or multiple Modbus payloads are in a single TCP frame? HOT 2
- Can this be used for Modbus sniffing? HOT 2
- Redundancy Check issues HOT 4
- Compatiblility with MicroPython HOT 1
- Simple TCP server example does not work, always returns error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from umodbus.