UDP

A connectionless UDP socket. Used by protocols that broadcast, that talk to devices which never open a connection of their own, or that were simply specified on top of UDP.

Transport syntax

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

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

Example
knxnet-ip://192.168.1.10
modbus-tcp:udp://192.168.1.100:502

Name

Type

Default Value

Required

Description

Name

UDP

Code

udp

Maven Dependency

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

Config options:

udp.local-address

STRING

Local address to bind to. If not set, binds to all interfaces.

udp.local-port

INT

0

Local port to bind to. 0 uses ephemeral port.

udp.read-timeout-ms

INT

0

Socket read timeout in milliseconds. 0 means no timeout.

udp.max-packet-size

INT

65507

Maximum UDP packet size in bytes.

udp.send-buffer-size

INT

0

Send buffer size in bytes. 0 uses system default.

udp.receive-buffer-size

INT

0

Receive buffer size in bytes. 0 uses system default.

udp.broadcast

BOOLEAN

false

Enable SO_BROADCAST for sending broadcast packets.

udp.reuse-address

BOOLEAN

false

Enable SO_REUSEADDR to allow multiple bindings to the same address/port.

udp.share-socket

BOOLEAN

false

Share the underlying UDP socket across multiple transport instances. When true, instances with the same localAddress:localPort will share a socket. This is useful for protocols where multiple logical connections share one UDP port.

udp.multicast-ttl

INT

1

Time-to-live for multicast packets (1-255).

Set udp.broadcast=true to send to a broadcast address, and udp.share-socket=true when several connections have to share one local port - which is what protocols that answer on a fixed port require.