-
Notifications
You must be signed in to change notification settings - Fork 1k
Recall socket recv until get a complete response. #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
+1 |
7f01fcc to
b32dde2
Compare
|
This seems like a rather important patch (which seems to work well, for me at least). Without it, pymodbus for TCP slaves hardly ever works. My read register calls return None a lot of the time. I am amazed no one else sees this issue. I am happy to do the work to bring it up to line with master. |
|
Hi @bje- , i have already updated the commit in a branch of my repository but i have not tested it yet. I will update the PR as soon as possible. |
Socket recv waits until it gets some data from the host but not necessarily the entire response that can be fragmented in many packets. In this case it receives an incomplete frame that is rejected by the frame handler. This commit solves this issue by recalling socket recv until get a complete modbus response.
|
Updated. |
|
Thank you, I will add this to 1.3.1 milestone. |
|
would also partially fix #175 |
|
@ccatterina Just to highlight a bug here with this fix, when there is an exception received from the modbus device, client will be struck in an eternal while loop or ends with socket error ,resulting in a None being returned back. I will have to revert this change. Sorry for not running the tests before merging this PR. |
|
Oh, rigth, i'm sorry that i didn't notice the bug before. I will try to fix this as soon as possible, meanwhile, revert it. |
This reverts commit 661c816.
Socket recv waits until it gets some data from the host but not necessarily the entire response that can be fragmented in many packets. In this case it receives an incomplete frame that is rejected by the frame handler. This commit solves this issue by recalling socket recv until get a complete modbus response.
Socket recv waits until it gets some data from the host but not necessarily the entire response that can be fragmented in many packets. In this case it receives an incomplete frame that is rejected by the frame handler. This commit solves this issue by recalling socket recv until get a complete modbus response.
…ev#143)" (pymodbus-dev#178) This reverts commit 661c816.
Socket recv waits until it gets some data from the host but
not necessarily the entire response that can be fragmented in
many packets. In this case it receives an incomplete frame
that is rejected by the frame handler.
This commit solves this issue by recalling socket recv until
get a complete modbus response.