Modbus RTU vs TCP: differences, conversion and when to use each
Part of the Modbus guide
Modbus RTU and Modbus TCP carry the same function codes and the same register data; they differ in the wire and the envelope. RTU runs on a serial line, usually RS-485, with a device address in front of each message and a CRC-16 behind it. TCP runs on Ethernet to port 502, with a seven-byte MBAP header in front and no checksum of its own. In the Modbus RTU vs TCP decision, the device usually chooses for you: use whichever port it has, and use a gateway when the two have to meet.
This page is part of the Modbus guide. Each side has its own page: Modbus RTU and Modbus TCP.
Modbus RTU vs TCP at a glance
| Modbus RTU | Modbus TCP | |
|---|---|---|
| Physical layer | Serial, usually two-wire RS-485 | Ethernet, or anything that carries IP |
| Topology | One daisy-chained bus | Switched network |
| Envelope | 1-byte address + PDU + 2-byte CRC | 7-byte MBAP header + PDU |
| Largest frame | 256 bytes | 260 bytes |
| Device addressing | Address 1 to 247 in the frame | IP address, plus a unit identifier for gateways |
| Error check | CRC-16 in every frame | None in Modbus; TCP and Ethernet checksums |
| Frame boundary | 3.5 character times of silence | Length field in the header |
| Clients | One per bus | Several per server |
| Broadcast | Yes, address 0, writes only | No |
| Devices per segment | 32 without a repeater | Limited by the network |
| Typical speed | 9600 or 19200 baud | 10 or 100 Mbit/s and up |
| Settings that must match | Baud rate, parity, stop bits, address | IP address, port, unit identifier |
Both share the limits that come from the PDU: at most 253 bytes of function code and data, so at most 125 registers or 2,000 coils per read.
How does a Modbus RTU frame convert to TCP?
Take a read of three holding registers starting at address 0x006B from device 17.
RTU: 11 03 00 6B 00 03 76 87
| | |
| PDU CRC-16
address
TCP: 00 01 00 00 00 06 11 03 00 6B 00 03
| | | | |
| | | | PDU
| | | unit identifier
| | length (6 bytes follow)
| protocol identifier (0)
transaction identifierThe five PDU bytes, 03 00 6B 00 03, are the same in both. The RTU address byte and the TCP unit identifier hold the same value. Converting from RTU to TCP means dropping the CRC and adding a transaction identifier, a zero protocol identifier and a length. Converting back means dropping those six bytes and computing a CRC. No register address or value is touched, which is why a register map written for one variant is valid for the other.
Speed and scan time
The difference in raw speed is large, but the reason polls feel slow on serial is the bus, not only the baud rate. At 9600 baud a character takes about 1.15 ms, so reading 10 registers costs roughly 46 ms on the wire before the device’s own processing time, and every device on the bus waits its turn behind every other one. Thirty devices with three requests each is several seconds per scan.
On Ethernet the same read is one small packet each way. The limit becomes the server’s processing time, typically a few milliseconds, and the client can poll many servers in parallel because each has its own connection.
A gateway does not make the serial side faster. Requests to devices behind it still queue on the RS-485 bus at the serial baud rate.
What a gateway changes
A Modbus gateway has an Ethernet port and one or more serial ports. A Modbus TCP client connects to the gateway’s IP address and puts the RS-485 address of the target device in the unit identifier. The gateway forwards the request as an RTU frame and returns the reply.
Four things to get right:
- The unit identifier must be the serial device’s address. With a direct Ethernet device the unit identifier often does not matter; behind a gateway it is the only thing that selects the device.
- The client’s timeout must be longer than the gateway’s serial timeout. Otherwise the client gives up, sends the next request, and the late reply to the first arrives in its place.
- The gateway is the single client on the serial bus. If a PLC is already the client on that RS-485 run, adding a gateway to the same wires puts two clients on one bus and both will see collisions. Use a gateway with a second serial port designed for that, or read the data from the PLC instead.
- Several TCP clients polling through one gateway share the same slow bus. Their combined poll rate has to fit in the serial scan time.
When the serial device is missing or silent, the gateway answers with exception 0B (gateway target device failed to respond). That code tells you the Ethernet half is fine. The function code reference lists the other exception codes.
Modbus RTU over TCP is a third thing
Many serial device servers and cellular modems offer a transparent mode that puts the raw serial bytes inside a TCP connection: address, PDU and CRC, with no MBAP header. Vendors call it RTU over TCP, raw socket or transparent mode. It is not Modbus TCP and it is not defined by the Modbus Organization.
Modbus TCP: 00 01 00 00 00 06 11 03 00 6B 00 03
RTU over TCP: 11 03 00 6B 00 03 76 87A Modbus TCP client connected to a transparent port gets no usable reply, because the device behind it reads the MBAP header as a garbled RTU frame and discards it. The reverse fails the same way. Both ends have to agree: either set the device server to its Modbus gateway mode, or use client software that explicitly supports RTU framing over a TCP socket. Transparent mode also keeps the RTU timing rules, so a network that delays part of a frame can break it in two.
Modbus RTU vs TCP: when to use each
Use the serial variant when the device only has an RS-485 port, which is still the norm for power meters, small drives, sensors and many generator and pump controllers. It is also reasonable for a new run of simple devices in one panel or along one cable tray, where a single shielded pair is cheaper than a switch port per device.
Use the Ethernet variant when the device has a network port, when more than one system needs to read it, when scan time matters, or when the devices are spread across a site that already has a network.
Mixed sites are the common case, and there the Modbus RTU vs TCP question is settled device by device. A typical arrangement is a PLC or a gateway that polls the serial devices and exposes their data on Ethernet, with everything upstream reading over TCP. The decision that remains is where the serial bus ends.
Neither variant offers authentication or encryption. A serial bus is protected by being a physically private cable; a TCP server is reachable by anything that can route to port 502, so it needs network segmentation.
Reading both with ControlCom
The ControlCom Edge Server, the on-site component of ControlCom Connect, offers both in the same Add New Client dialog: Modbus TCP and Modbus RTU. The TCP client takes an endpoint IP and port; the RTU client takes a serial device path with baud rate, data bits, stop bits and parity, and needs the serial device mounted into the Edge Server container. Everything after the Connection tab is the same for both: units with their Unit ID, and tags with an address scope, data type, address, scale and offset. One TCP client with several units reads every device behind a gateway.
The Modbus client documentation covers both variants. The platform overview shows where the data goes, and the wastewater page describes how treatment plant PLCs are read this way.
Serial meters and Ethernet PLCs on the same site end up as variables in the same ControlCom Connect account, read by one Edge Server.