TCP

The default transport for most Ethernet-based protocols: a plain TCP client socket.

Transport syntax

{IP address or hostname}[:{port}]

The port may be omitted if the driver declares a default port for the protocol.

Example
modbus-tcp://192.168.1.100
modbus-tcp:tcp://plc-hall-2.example.com:502

Name

Type

Default Value

Required

Description

Name

TCP

Code

tcp

Maven Dependency

<dependency>
  <groupId>org.apache.plc4x</groupId>
  <artifactId>plc4j-transports-tcp</artifactId>
  <version>1.0.0</version>
</dependency>

Config options:

tcp.connect-timeout-ms

INT

5000

Connection timeout in milliseconds.

tcp.read-timeout-ms

INT

0

Socket read timeout in milliseconds. 0 means no timeout.

tcp.write-timeout-ms

INT

0

Socket write timeout in milliseconds. 0 means no timeout.

tcp.no-delay

BOOLEAN

true

Enable TCP_NODELAY (disable Nagle’s algorithm).

tcp.keep-alive

BOOLEAN

false

Enable SO_KEEPALIVE.

tcp.send-buffer-size

INT

81920

Send buffer size in bytes. 0 uses system default.

tcp.receive-buffer-size

INT

81920

Receive buffer size in bytes. 0 uses system default.

tcp.local-address

STRING

Local address to bind to (optional). If not set, uses default.

tcp.local-port

INT

0

Local port to bind to (optional). 0 uses ephemeral port.

The options above are the ones this transport declares. Some drivers add their own on top of them - the ADS driver, for instance, adds AMS options to tcp - and those are listed in that driver’s table on its protocol page.