libmodbus
libmodbus copied to clipboard
Added feature RTU over TCP
Hi. As you told me in https://github.com/stephane/libmodbus/issues/257 I have made a pull request for you.
I have adapted this patch https://groups.google.com/forum/#!msg/libmodbus/xm8S6MMDhgM/Qd97y9_mhwgJ for the current version of libmodbus.
As I told you I'm a very newbie as C programmer and I am sure that my solution is not the best. If you could take a look to my branch I think you could rewrite a better solution without problems. I think that this feature could be interesting for other people too.
Thanks for your job.
Indeed, this would be a cool feature. And you are right, the implementation is ... straightforward :smile: I'll try to test it next weekend, however, I cannot promise.
I wonder, whether we should to think a little bit more general but simply connecting to a socket and implement a RFC2217 layer. Thus we could also support ethernet to serial gateways which support changing baudrate etc. I know this would require some more work...
This will be great mhei. I simply find a patch for a previous version of modbus and I apply it to the master branch. The code isn't event mine. But I agree, this feature could be interesting for other people too, so I will be waiting for news.
Thanks.
Just a confirmation: I'm successfully using this patch (on libmodbus 3.1.4) to read a ModbusRTU over TCP device.
RTU over TCP is indeed a poor and non standard protocol, but sadly it is used in the real world. So it would be cool to have this included in libmodbus.
Regards
Hello, any news on this? Really looking forward to this feature in the master branch in order to implement it in https://github.com/v-zhuravlev/libzbxmodbus Thank you in advance!
Please consider my approach (#445). It contains both server, client, test, documentation code. however I assumed that the slave id must be set and considered. Please comment especially whether the slave id should be considered or not. I assumed RTU considers it so RTU over TCP should do it, too.
I think this functionality is essential. It is not the ideal case, but in real life RTU over TCP is widely used as discussed in https://github.com/stephane/libmodbus/issues/257#issuecomment-93717670 In our use case, it is essential and what limits us the most today. @stephane could you take a look at it and rate its inclusion. I am available in case help is needed for this implementation.