The short answer
Modbus TCP
Modbus TCP carries Modbus requests over an Ethernet TCP connection on port 502. The application data is identical to Modbus RTU, but the serial framing and CRC are replaced by a seven-byte MBAP header and TCP handles delivery and integrity. Multiple masters can talk to one device simultaneously over separate connections, which is the main practical advantage over serial.
Key points
- Same function codes and register model as RTU; only the transport changes.
- TCP port 502. The CRC is gone because TCP provides integrity.
- The unit identifier matters when a gateway fronts serial devices; otherwise it is often 255 or 1.
- Multiple clients can poll one server concurrently, unlike single-master serial.
- Register addressing ambiguity and word order are exactly as troublesome as on serial.
What changes and what does not
The part of the message that carries meaning, the function code, the register address, the quantity, and the data, is unchanged. What changes is the envelope around it.
| Element | Modbus RTU | Modbus TCP |
|---|---|---|
| Transport | RS-485 or RS-232 serial | Ethernet, TCP port 502 |
| Framing | Silent interval of 3.5 character times | MBAP header with a length field |
| Error checking | CRC-16 in the message | Handled by TCP |
| Addressing | Slave address 1-247 | IP address, plus a unit identifier |
| Concurrency | One master, one transaction at a time | Multiple clients, multiple outstanding transactions |
| Typical speed | 9600 to 115200 baud | 100 Mbps or better |
The MBAP header
Seven bytes precede every Modbus TCP request and response.
- Transaction identifier (2 bytes)
- Echoed by the server so a client can match a response to its request. This is what allows several outstanding transactions at once.
- Protocol identifier (2 bytes)
- Zero for Modbus.
- Length (2 bytes)
- Byte count of what follows. This replaces the silent-interval framing of RTU.
- Unit identifier (1 byte)
- Identifies the target when a gateway sits in front of serial devices. For a native Ethernet device it is frequently 255 or 1, and some devices ignore it entirely.
What Ethernet actually buys you
- Speed. Reading several hundred registers is effectively instantaneous rather than a measurable delay.
- Concurrency. A PLC and a SCADA system can poll the same device at the same time without a gateway arbitrating.
- Distance and infrastructure. It uses the network you already have, including fiber between buildings.
- Better diagnostics. Switch port counters, packet captures, and connection state are all available, none of which exist on a serial bus.
What it does not fix
- 01Register addressing ambiguity. The 40001 versus offset-0 problem is identical.
- 02Word and byte order for 32-bit values. Identical, and just as undocumented.
- 03Device slowness. A device with a slow internal scan is slow regardless of transport.
- 04Security. Modbus TCP has no authentication or encryption, and now it is reachable from anything routable to it, which is strictly worse.
Diagnosing it
- 1
Prove IP connectivity
Ping the device. If it does not answer, this is a network problem, not a Modbus problem, and everything below is wasted effort until it is fixed.
- 2
Prove the port is open
Attempt a TCP connection to port 502. A refused connection means the service is not running or is on a different port. A timeout usually means a firewall or a routing problem.
- 3
Read with an independent tool
Use a Modbus client utility from a laptop. If it reads correctly and the PLC does not, the problem is in the controller configuration, not the device.
- 4
Check the unit identifier
Particularly with a gateway. Try the serial slave address, then 1, then 255.
- 5
Capture packets if it is still unclear
A capture on port 502 shows the exact request, the exact response, and any exception code. This turns speculation into fact faster than any other step.
- 6
Watch connection count
Some devices support only a small number of simultaneous TCP connections. A client that opens a new connection per poll and never closes cleanly will exhaust them, and the symptom is a device that works for hours and then refuses everything.
Frequently asked questions
- What port does Modbus TCP use?
- TCP port 502 by default. Some devices allow it to be changed, and some vendors additionally offer Modbus over a secure transport on a different port.
- Do I need a CRC in Modbus TCP?
- No. TCP provides error detection and retransmission, so the Modbus CRC is omitted. Sending a request with an RTU CRC appended to a TCP connection produces an error, which is a common mistake when adapting serial code.
- What unit identifier should I use?
- For a native Ethernet device, try 1 or 255; many ignore the field. For a gateway fronting serial devices, use the serial slave address of the target device. This is the correct answer far more often than people expect.
- Can Modbus TCP and Modbus RTU coexist?
- Yes, with a gateway. It presents a TCP server on the Ethernet side and acts as the single serial master on the RS-485 side, using the unit identifier to select the slave. This is extremely common in retrofits.
Related topics
- Modbus RTUSerial Modbus over RS-485: function codes, register addressing, the off-by-one that catches everyone, and the physical layer details that decide whether a bus is stable.
- Protocol GatewaysProtocol converters between a controller and devices that do not speak its language: what a gateway does, the common pairings in water and wastewater, the mapping table that is the whole configuration, the failure modes a gateway adds, and when to use a native interface instead.
- Zones and ConduitsThe IEC 62443 way to segment a control system: grouping assets into zones with a shared security level, inventorying every conduit between them, and turning the drawing into firewall rules. With a worked water utility example.
- Device Times OutA polled device that answers late or not at all: how to read the driver counters, tell a dead device from a slow one, and find the timeout setting, the bus loading, the radio latency, the duplicate address, or the device that is simply too busy to answer.
- EtherNet/IPHow EtherNet/IP moves control data: CIP over standard Ethernet, implicit I/O connections on a requested packet interval, explicit messaging, producer and consumer tags, and what the network has to provide.
- DNP3The protocol built for utility telemetry: master and outstation, static and event data classes, unsolicited reporting, time-stamped events, and why it suits slow links that Modbus does not.
Direct contact
Have a controls question?
Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.