MangoAutomation / modbus4j

A high-performance and ease-of-use implementation of the Modbus protocol written in Java. Supports ASCII, RTU, TCP, and UDP transports as slave or master, automatic request partitioning and response data type parsing.
GNU General Public License v3.0
891 stars 368 forks source link

Modbus RTU over TCP #19

Closed deinok closed 5 years ago

deinok commented 6 years ago

Hi, is there any support for this kind of conection?

terrypacker commented 6 years ago

There is no support 'out of the box', but I would suspect it would work with some additional coding. If you were to provide a SerialPortWrapper that uses a TCP/IP Socket you should be able to create an RtuSlave or RtuMaster. We have done something like this is Mango Automation which we have called a SerialSocketBridge and SerialServerSocketBridge. I haven't personally tested Mango with a ModbusRTU data source using one of these virtual serial ports so I can't make any guarantees. The code is open source so feel free to poke around and see what you can come up with.

But that would be a good place to start.

deinok commented 6 years ago

Good to know, are PR accepted for this?

El 7 mar. 2018 16:26, "Terry Packer" notifications@github.com escribió:

There is no support 'out of the box', but I would suspect it would work with some additional coding. If you were to provide a SerialPortWrapper that uses a TCP/IP Socket you should be able to create an RtuSlave or RtuMaster. We have done something like this is Mango Automation which we have called a SerialSocketBridge and SerialServerSocketBridge. I haven't personally tested Mango with a ModbusRTU data source using one of these virtual serial ports so I can't make any guarantees. The code is open source so feel free to poke around and see what you can come up with.

But that would be a good place to start.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/infiniteautomation/modbus4j/issues/19#issuecomment-371174569, or mute the thread https://github.com/notifications/unsubscribe-auth/AGR-xcZL44VYRzrrjzIxyfeG4rdVaHVdks5tb_wxgaJpZM4SgGKk .

terrypacker commented 6 years ago

Absolutely.

deinok commented 6 years ago

Will send it ASAP

El 7 mar. 2018 16:29, "Terry Packer" notifications@github.com escribió:

Absolutely.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/infiniteautomation/modbus4j/issues/19#issuecomment-371175434, or mute the thread https://github.com/notifications/unsubscribe-auth/AGR-xZpFafnlML-t_sw1G6ZZM5GX4nyEks5tb_y9gaJpZM4SgGKk .

terrypacker commented 6 years ago

Here is the source for our implementation: https://github.com/infiniteautomation/ma-core-public/blob/main/Core/src/com/infiniteautomation/mango/io/serial/virtual/SerialServerSocketBridge.java

ghost commented 5 years ago

i have checked ,rtu over tcp Communication message actually is same as tcpmaster use encapsulated,so we can use the tcpmaster with encapsulated option,and EncapMessage is same as RtuMessage,just communiction channel different.of course,rtu ove tcp is one more choice.

terrypacker commented 5 years ago

Thanks, just worked that out. I'll remove the class in the corresponding PR from the codebase then.