Idiomatic way to invert server <-> client workflow #2109
-
I have a hardware Modbus gateway that does RTU <-> TCP conversion. It can connect to a spefieid IP itself. What would be the best way to implement a TCP server that would:
I went through the source code and found the serial forwarder example that briefly resembles that I need, but still it requires a separate remote Modbus server to forward its requests to, whereas I'd like to stay within the same established TCP connection. I also came up with a hacky solution that instantiates a Modbus TCP client with an empty host, initiates a genenric TCP bind/accept loop, and for each accepted socket does So my question is - should I look deeper or is my idea not compatible with pymodbus architecture whatsoever? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I do not think I understand what you want...A client needs a server to talk to and visaversa. therefore if you en essence are building a forwarder (sounds like it) the client part needs somewhere to connect. As I understand it:
Our example serial forwarder seems to do what you mostly want (apart from the part I do not understand) |
Beta Was this translation helpful? Give feedback.
-
Let put it simpler - there's a client and I'm running a server. I want my server to poll the client's registers as soon as the client connected. The thing is the server class instance, |
Beta Was this translation helpful? Give feedback.
Then let me put it simple too.
A server cannot poll a client, that is against the protocol. The client is the initiator, issues requests to a server and the server responds.