-
Notifications
You must be signed in to change notification settings - Fork 448
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
Modbus TCP Master is creating multiple connections to single TCP Gateway #195
Comments
modbus_master.cpp contains implementation of port sharing in modbus RTU. Similar approach should be used for TCP connection. Functions initializeMB() and querySlaveDevices() should be adjusted. |
I was about to write exactly what you wrote! :) A similar strategy was already developed for RTU, since they must share the same COM/TTY port. Thank you for contributing fixing this. Let me know if you need any help. |
Thank you for confirmation. I have analyzed the code and have performed refactor. I have only one doubt. I cannot figure out what is purpose of |
@thiagoralves - I have another question. |
The |
This is the commit that added it: 34f2a2d I don't remember the justification for why this guy added it there if there was already a calculated pause according to the baud rate. Maybe checking his commit you will have some hints, but my guess is that it is redundant and can be removed |
He is the one that made the changes so that RTU devices can share the same port: #156 As far as I can tell, the default value for the transmission pause is zero, so it shouldn't affect anything. It is more an optional field on the UI that can delay the transmission of new packets. Perhaps the only thing to do in there would be to add a check |
Are you planning to add this feature? |
@Wawszczak is your PR ready? |
When multiple TCP modbus slaves are configured with the same IP and TCP port and different Slave ID for every of them, then engine tries to create multiple TCP connection for each of slaves separatelly.
Many of gateways (all but one I have tested) have limitation to 2-4 connections. This makes issues in querying network consisting more devices over the TCP connection limit.
It results in dropping connection, reconnecting and generally poor performance.
I can help solving this, but need guidance where it is implemented.
Current behavior:
separate TCP connection for each slave regardless the IP/PORT TCP destination.
Expected behavior:
common TCP connection for all slaves sharing common IP/PORT pair.
The text was updated successfully, but these errors were encountered: