Modbus TCP - Knowledge Base

Modbus TCP overview covering Ethernet transport, MBAP header, Unit ID usage, and comparison to Modbus RTU.

Categories:

What Modbus TCP Is

Modbus TCP is Modbus transported over Ethernet TCP/IP. It uses the same function codes and data model as Modbus RTU but replaces serial framing and CRC with a TCP header (MBAP — Modbus Application Protocol header).

The default TCP port is 502.

MBAP Header

FieldSizePurpose
Transaction ID2 bytesMatches requests to responses
Protocol ID2 bytesAlways 0x0000 for Modbus
Length2 bytesRemaining message length
Unit ID1 byteDevice identifier (relevant for gateways)

Unit ID

In Modbus TCP, the Unit ID field identifies the target device behind a gateway. For standalone Modbus TCP devices, Unit ID is typically 1 or 255. For gateways bridging TCP to serial, the Unit ID maps to the downstream RTU slave ID.

[!NOTE] Some Modbus TCP devices ignore the Unit ID entirely. Others require it to be a specific value. Always confirm with the vendor’s documentation.

TCP vs RTU

AspectModbus TCPModbus RTU
Error detectionTCP checksums (no CRC)CRC-16
Concurrent connectionsMultipleSingle bus (one master polls)
DistanceUnlimited (IP network)~1200 m (RS-485)
LatencyNetwork dependentBaud rate dependent

Need more help?

If this page does not resolve the issue, contact Chipkin support with the product model, protocol details, and any diagnostics you have already captured.

Open Chipkin Support