Search code examples
telnetmodbusmodbus-tcp

Send query to a Modbus device over Internet


I just started working on a Modbus project with no background. What I am trying to do is Query an active Modbus device by using its IP address, reading registers etc.
I connected the device by using 'telnet' command with the relevant IP address and port number and when its connected, it waits for a command. The problem is when I type anything and press enter, It doesn't seem to send anything since it allows me to write more to the new line and it doesn't give any response.
I guess I lack knowledge about a very basic concept about querying this kind of devices over the Internet.


Solution

  • Unless you are very good at typing binary data into telnet, and reading the binary response, you're not going to be able to communicate with a Modbus/TCP slave via telnet.

    You'll want to locate one of the many open source Modbus libraries that are available on the Internet and use that. I'm the maintainer for "j2mod", which is available here --

    https://sourceforge.net/projects/j2mod/

    and write your own client. There are a large number of test programs in the "cmds" directory that you can use as templates until you learn the library. There are also open source libraries for languages other than Java. Generally speaking, searching for " modbus library" will find what you're looking for.