The TCP port used is: 502.
Request Format:| Name | | Length | Function |
|---|
| Transaction Identifier | MBAP | 2 | For synchronization between messages of server and client |
| Protocol identifier | 2 | 0 for Modbus/TCP |
| Length field | 2 | Number of remaining bytes in this frame |
| Unit identifier | 1 | Unit address (255 if not used) |
| Function code | PDU | 1 | Function codes as in other variants |
| Address of first register | 2 | Address of the first register |
| Number of registers | 2 | Number of registers |
Response:| Name | | Length | Function |
|---|
| Transaction Identifier | MBAP | 2 | For synchronization between messages of server and client |
| Protocol identifier | 2 | 0 for Modbus/TCP |
| Length field | 2 | Number of remaining bytes in this frame |
| Unit identifier | 1 | Unit address (255 if not used) |
| Number of Bytes following | PDU | 1 | Number of Bytes following |
| Data | N | Data |
MBAP Header = Modbus Application Header
PDU = Protocol Data Unit
Simply Modbus: Modbus TCP Protocol