COTP

COTP (Connection-Oriented Transport Protocol, ISO 8073 / RFC 905) layered over TPKT and TCP - the "ISO on TCP" stack that Siemens S7 equipment speaks. It is a TCP transport that performs the COTP connection handshake and negotiates a TPDU size before the driver sees the connection.

Because the handshake carries the TSAPs that address a specific rack and slot, this transport is what the S7 driver uses by default. Drivers normally derive the TSAP values themselves - override them only if you know the device expects something else.

Transport syntax

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

The port defaults to the driver’s default, which is 102 for S7.

Example
s7://10.0.0.1
s7:cotp://10.0.0.1:102?cotp.tpdu-size=1024

Name

Type

Default Value

Required

Description

Name

COTP

Code

cotp

Maven Dependency

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

Config options:

cotp.local-tsap

INT

0

Local TSAP (Transport Service Access Point) identifier.

cotp.remote-tsap

INT

0

Remote TSAP (Transport Service Access Point) identifier.

cotp.tpdu-size

INT

8192

COTP PDU size for data transmission. Valid values: 128, 256, 512, 1024, 2048, 4096, 8192.

cotp.handshake-timeout-ms

INT

5000

Connection timeout for COTP handshake in milliseconds.

cotp.protocol-class

INT

0

COTP protocol class to use. Class 0 is most commonly used (simple class, no flow control).

cotp.connect-timeout-ms

INT

5000

Connection timeout in milliseconds.

cotp.read-timeout-ms

INT

0

Socket read timeout in milliseconds. 0 means no timeout.

cotp.write-timeout-ms

INT

0

Socket write timeout in milliseconds. 0 means no timeout.

cotp.no-delay

BOOLEAN

true

Enable TCP_NODELAY (disable Nagle’s algorithm).

cotp.keep-alive

BOOLEAN

false

Enable SO_KEEPALIVE.

cotp.send-buffer-size

INT

81920

Send buffer size in bytes. 0 uses system default.

cotp.receive-buffer-size

INT

81920

Receive buffer size in bytes. 0 uses system default.

cotp.local-address

STRING

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

cotp.local-port

INT

0

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

The socket options are inherited from the TCP transport and behave identically.