---
id: network--udp-client-plugin
title: "UDP client"
summary: "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."
audience: user
keywords: "input, output, continue, address, port, receivebuffersize, sendbuffersize"
---
# 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

| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | `Viaducta.Plugins.UdpTypes.UdpDatagram`, `Viaducta.Plugins.TextPlugin.Types.TextRecord` | Data to send. |
| Output | output | `Viaducta.Plugins.UdpTypes.UdpDatagram` | Datagrams received from the remote endpoint, with new metadata. |
| Continue | continue | same as input | Called after sending, with the original input and metadata. |

## Configuration

| Field | Type | Default | Description |
|---|---|---|---|
| `Address` | string | `127.0.0.1` | Required. Target host name or IP. |
| `Port` | integer (1-65535) | `7000` | Required. Target port. |
| `ReceiveBufferSize` | integer (KB, 8-2048) | `64` | Socket receive buffer. Too small buffers can drop incoming datagrams. |
| `SendBufferSize` | integer (KB, 8-2048) | `32` | Socket 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) → ...
