Skip to main content

UDP

Send and receive UDP datagrams for high-speed, connectionless network communication.

udp
input v1.0.0

Send and receive UDP datagrams. Supports listen mode (receive packets on a port) and send mode (transmit packets to a host). Ideal for high-frequency, low-latency data where occasional packet loss is acceptable.

udp datagram network broadcast
Inputs
1
Outputs
1

Overview

The udp node handles UDP (User Datagram Protocol) communication. UDP is ideal for:

  • High-frequency sensor data - Fast updates where occasional packet loss is acceptable
  • Broadcasting - Send data to all devices on a network segment
  • Device discovery - Find devices on the local network
  • Syslog / SNMP - Standard network management protocols
  • Low-latency telemetry - Real-time data with minimal overhead
Connectionless Protocol

UDP is connectionless and unreliable. Packets may arrive out of order, be duplicated, or lost entirely. Use TCP Client if you need guaranteed delivery.

Properties

Property Type Required Default Description
mode select listen Operation mode: "listen" to receive datagrams, "send" to transmit datagrams.
host string - - Target host address (required in send mode).
port number 9999 UDP port number to listen on or send to.
bufferSize number - 4096 Receive buffer size in bytes (listen mode).

Listen vs Send Mode

listen Receive Datagrams

Binds to the specified port and emits a message on the output port for every UDP packet received. host is not required. The output message includes the sender's IP and port.

send Transmit Datagrams

Sends msg.payload as a UDP datagram to the configured host and port. Input triggers the send; no output is produced.

Message Format

In listen mode, received packets produce:

{
  "payload": "received data (string or Buffer)",
  "ip": "192.168.1.50",
  "port": 54321,
  "_msgid": "<unique message id>"
}
Property Type Description
payload string / Buffer Datagram content
ip string Sender's IP address
port number Sender's port number

Examples

Syslog Receiver

Receive syslog messages from network devices on port 514.

Syslog Server

Receives syslog messages and routes by severity.

View Flow JSON
[
  &#123;
    "id": "udp1",
    "type": "udp",
    "name": "Syslog",
    "mode": "listen",
    "port": 514,
    "wires": [["function1"]]
  &#125;,
  &#123;
    "id": "function1",
    "type": "function",
    "name": "Parse Syslog",
    "func": "const match = msg.payload.match(/^&lt;(\\d+)&gt;(.+)/);\nif (match) &#123;\n  const pri = parseInt(match[1]);\n  const severity = pri % 8;\n  const names = ['Emergency','Alert','Critical','Error','Warning','Notice','Info','Debug'];\n  msg.payload = &#123; severity: names[severity], level: severity, message: match[2].trim(), source: msg.ip &#125;;\n  return msg;\n&#125;\nreturn null;",
    "wires": [["debug1"]]
  &#125;,
  &#123;
    "id": "debug1",
    "type": "debug",
    "name": "Log"
  &#125;
]

UDP Sender

Send commands or data to a UDP endpoint on a schedule.

UDP Command Sender

Sends a UDP datagram to a device every 10 seconds.

View Flow JSON
[
  &#123;
    "id": "inject1",
    "type": "inject",
    "name": "Every 10s",
    "repeat": "10",
    "payload": "PING",
    "wires": [["udp2"]]
  &#125;,
  &#123;
    "id": "udp2",
    "type": "udp",
    "name": "Send to Device",
    "mode": "send",
    "host": "192.168.1.200",
    "port": 5000,
    "wires": []
  &#125;
]

Troubleshooting

Not receiving any packets
  • Verify the flow is deployed and the node is in listen mode
  • Check firewall allows UDP on the specified port
  • Test with netcat: echo "test" | nc -u host port
  • Verify sender and receiver are on the same network (for broadcast)
Packets arriving out of order

This is normal UDP behavior. If ordering matters:

  • Include sequence numbers in your packets
  • Buffer and reorder in a function node
  • Consider using TCP Client instead if ordering is critical