Skip to content

UDP client ​

Sends the bytes of every input record as one UDP datagram to a configured address and port, and optionally emits the datagrams the remote side sends back. Use it for UDP-based devices, telemetry or simple request/reply protocols.

Pins ​

PinKindTypesDescription
InputinputViaducta.Plugins.UdpTypes.UdpDatagram, Viaducta.Plugins.TextPlugin.Types.TextRecordData to send.
OutputoutputViaducta.Plugins.UdpTypes.UdpDatagramDatagrams received from the remote endpoint, with new metadata.
Continuecontinuesame as inputCalled after sending, with the original input and metadata.

Configuration ​

FieldTypeDefaultDescription
Addressstring127.0.0.1Required. Target host name or IP.
Portinteger (1-65535)7000Required. Target port.
ReceiveBufferSizeinteger (KB, 8-2048)64Socket receive buffer. Too small buffers can drop incoming datagrams.
SendBufferSizeinteger (KB, 8-2048)32Socket send buffer.

Behaviour ​

  • On the first record a UDP socket is created and bound ("connected") to Address:Port; it is reused for later records.
  • What is sent (one datagram per record):
    • UdpDatagram: the Data bytes.
    • TextRecord: Value encoded as UTF-8.
    • Empty data or another type throws an exception.
  • If Output has connections when the socket is created, a background reader emits every datagram received from Address:Port as a UdpDatagram (IP, Port of the sender, Data) with new metadata. Replies are not correlated with requests.
  • Continue is called after each send.

Notes ​

  • The target is always Address:Port from the configuration. UdpDatagram.IP / Port are not used as the destination; worse, a datagram whose IP differs from Address makes the component create a new socket (and reader) for every record without closing the old one. Leave IP empty (or equal to Address) on input datagrams.
  • UDP gives no delivery guarantee: Continue only means the datagram was handed to the network stack.
  • Datagrams larger than the network MTU are fragmented by IP and may be lost on some networks; keep payloads small.

Example ​

json
{ "Address": "192.168.1.50", "Port": 9000, "ReceiveBufferSize": 64, "SendBufferSize": 32 }

Data mapper (build TextRecord) → UDP client → Output → (decode reply) → ...

Viaducta documentation