Today is...
Monday, May 21, 2018
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
A demonstration of EtherCAT control of linear motors using the CTC EtherCAT master.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Modbus RTU Message in TCP Packet?
Possibility to wrap a Modbus RTU Message in a TCP packet.


I am working on a prototype where the customer wish to connect a Modbus RTU device to the Internet through a low cost solution consisting of an external converter. The Modbus Slave would reside in the serial device, and the Master would typically reside on a remote computer/handheld unit.

I have managed to find a Ethernet to Serial device that simply just translates between the two transport layers in the price range of 70 $ which is the target.

The client dont want to implement too much extra code on the serial device side.

My question is if it would be possible to simply wrap a Modbus RTU packet in the TCP packet (On the Master side) so that the converter can just strip the TCP packet and send the RTU packet to the serial device?

In the opposite direction, the serial device would just send a Modbus RTU message to the converter which will dress the packet in a tcp/ip header and send it to the remote computer/handheld device which in turn would parse the message.

Or am I thinking completely wrong?

Please dont respond with answers like considering buying this or that router, because I have already ruled that out. :)

How my question makes sense.


By Bob Peterson on 6 April, 2018 - 9:49 am

There are several options available to you that might work.

There are serial port converters that will convert the RS232 port on the back of your computer to ethernet, send it to a remote device and reconvert it back to rs232. They generally do not care much what the message structure is. You just tell the software that resides on your PC what port to look at.

There are also ethernet devices that create a virtual com port out on your network. The driver creates a COMX port on your PC that is actually a piece of hardware somewhere on your network. Again it does not much care much about the message structure. You assign the network device to a com port, say COM20. the software on your PC looks at COM20 and gets directed out to the device on your network.

There are also various Modbus specific devices, but I doubt any of them will fit your target price.

Whether there is a solution for you at the arbitrary price you have set is something I cannot tell you.

There is no way to get around having some kind of Modbus driver on your PC. You will either have to write one or buy one.


By Fred Loveless on 6 April, 2018 - 10:38 am


yes it is it is called Modbus over TCP not to be confused with Modbus TCP. This is essentially what the serial to Ethernet converter is doing but the port replication software strips the serial packet out of the pay load. Most converters allow you to connect directly to the converter with out the port software and manage the packet when it comes in. Our server product, KEPServerEX, allows users to do Ethernet Encapsulation of serial drivers which is essentially what you are trying to do.

Oh, you can use wireshark to look at the packets going between the PC and the converter and you should see the Modbus RTU packet as the data payload.

I'm sorry to hear that you have ruled out other solutions.

Maybe for the next time consider using a serial to ethernet converter with virtual serial port capabilities or use a Modbus RTU to modbus TCP gateway. In both cases you do not have to wrap, strip, dress or other strange things you want to do.

Actually, it not really me who has ruled out other options. It is rather the customer and the price target of ~70$ for the converter.

Thanks for your reply!

Even in that price range you can find serial to Ethernet converters with virtual serial port support. If you can spend around 100, ICP DAS has converters/gateways with Modbus support.