Skip to content
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

Can i control if single or multiple Modbus payloads are in a single TCP frame? #128

Open
StefanR71 opened this issue Mar 7, 2024 · 2 comments

Comments

@StefanR71
Copy link

Hi,

i'm using the modbus-cli which uses uModbus.

When i'm doing a query for some registers, modbus-cli is grouping this registers and i need perhaps 3 modbus requests. This 3 requests will be put in 2 TCP packets, the first TCP packet has one Modbus payload and the second TCP packet contains the last 2 Modbus payloads.

image

Who is controlling the creation of the TCP packets?

Can i change here something, that each Modbus packet is getting a own TCP packet?

And this is every time the same, ich have every time 2 TCP packets, the first TCP packet has every time one Modbus packet inside and the second TCP packet has all the rest inside, i have seen up to 19 Modbus packets here in my tests.

Best Regards
Stefan

@acolomb
Copy link
Contributor

acolomb commented Mar 7, 2024

Just as a heads-up, this project seems currently abandoned. I haven't got feedback on my issues and pull requests for a couple of years, so I don't expect anyone to jump in and answer your questions.

As to your actual matter, sorry I can't help you much, having used only the RTU version so far. But in principle, TCP is a stream protocol, not packet-oriented. The operating system's network stack usually decides where to cut off that stream and push it into an underlying IP packet. The logic / heuristics for that can be buried quite deeply. If you can trace it down to actual network writes to the TCP socket within the Python code, that would of course be a natural opportunity to split at. But as long as TCP is not directly implemented in Python, it could be unpredictable, with shorter packets or even waiting to assemble longer packets.

Sorry if that doesn't really help you. Hope someone more knowledgeable will turn up ;-)

@StefanR71
Copy link
Author

No problem, this are already some helpful comments, perhaps someone else has seen a similar behavior and found a solution.

So let's see if someone else has a comment or hint to this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants