Skip to content

Conversation

@ccatterina
Copy link
Contributor

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.

@bje-
Copy link
Contributor

bje- commented Mar 24, 2017

+1

@ccatterina ccatterina force-pushed the master branch 2 times, most recently from 7f01fcc to b32dde2 Compare May 12, 2017 12:47
@bje-
Copy link
Contributor

bje- commented May 29, 2017

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.

@ccatterina
Copy link
Contributor Author

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.
@ccatterina
Copy link
Contributor Author

Updated.

@dhoomakethu dhoomakethu added this to the 1.3.1 milestone Jun 1, 2017
@dhoomakethu
Copy link
Contributor

Thank you, I will add this to 1.3.1 milestone.

@dhoomakethu
Copy link
Contributor

would also partially fix #175

@dhoomakethu dhoomakethu modified the milestones: 1.3.0, 1.3.1 Jun 4, 2017
@dhoomakethu dhoomakethu merged commit 661c816 into pymodbus-dev:master Jun 5, 2017
@dhoomakethu
Copy link
Contributor

dhoomakethu commented Jun 5, 2017

@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.

@ccatterina
Copy link
Contributor Author

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.

dhoomakethu added a commit that referenced this pull request Jun 5, 2017
dhoomakethu added a commit that referenced this pull request Jun 5, 2017
dhoomakethu pushed a commit that referenced this pull request Nov 28, 2017
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.
dhoomakethu added a commit that referenced this pull request Nov 28, 2017
ccatterina added a commit to ccatterina/pymodbus that referenced this pull request Apr 17, 2018
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.
ccatterina pushed a commit to ccatterina/pymodbus that referenced this pull request Apr 17, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants