Configure UDP

Set up UDP communication ports

Configure UDP

Configure UDP ports and settings for OctoMY™ node communication.

Pro Tip

The default ports (8123-8126) are chosen to avoid common conflicts. If you need to change them, pick ports above 1024 to avoid needing root permissions.


Default port configuration

OctoMY™ uses UDP for all node-to-node communication:

Node Type Default Port Purpose
Zoo 8123 Discovery service
Agent 8124 Robot nodes
Remote 8125 Controller nodes
Hub 8126 Coordinator nodes

Changing the default port

Via command line

# Start Agent on custom port
./agent --personality MyRobot --port 9124

# Start Remote on custom port
./remote --personality MyController --port 9125

Via settings

  1. Open ☰ MenuSettings
  2. Navigate to Connection section
  3. Change Listen Port
  4. Restart the node for changes to take effect

Firewall configuration

Linux (ufw)

# Allow OctoMY ports
sudo ufw allow 8123/udp  # Zoo
sudo ufw allow 8124/udp  # Agent
sudo ufw allow 8125/udp  # Remote
sudo ufw allow 8126/udp  # Hub

# Verify rules
sudo ufw status numbered

Linux (firewalld)

# Add permanent rules
sudo firewall-cmd --add-port=8123-8126/udp --permanent

# Reload firewall
sudo firewall-cmd --reload

# Verify
sudo firewall-cmd --list-ports

Linux (iptables)

# Allow OctoMY ports
sudo iptables -A INPUT -p udp --dport 8123:8126 -j ACCEPT

# Save rules (Debian/Ubuntu)
sudo iptables-save > /etc/iptables/rules.v4

Windows

# Open PowerShell as Administrator
New-NetFirewallRule -DisplayName "OctoMY UDP" `
    -Direction Inbound `
    -Protocol UDP `
    -LocalPort 8123-8126 `
    -Action Allow

macOS

# Edit /etc/pf.conf and add:
pass in proto udp from any to any port 8123:8126

# Reload firewall
sudo pfctl -f /etc/pf.conf

Network interface binding

By default, OctoMY™ listens on all interfaces. To bind to a specific interface:

Command line

# Bind to specific IP
./agent --personality MyRobot --bind 192.168.1.100

Use cases

Scenario Bind To
All interfaces 0.0.0.0 (default)
Local network only Your LAN IP (e.g., 192.168.1.x)
Localhost only 127.0.0.1

UDP buffer sizes

For high-frequency sensor data or multiple connections, increase UDP buffers:

Linux

# Check current values
sysctl net.core.rmem_max
sysctl net.core.wmem_max

# Increase buffers (temporary)
sudo sysctl -w net.core.rmem_max=26214400
sudo sysctl -w net.core.wmem_max=26214400

# Make permanent - add to /etc/sysctl.conf:
# net.core.rmem_max=26214400
# net.core.wmem_max=26214400

Recommended values

Use Case Buffer Size
Single connection 1 MB (default)
Multiple Agents 8 MB
High-frequency sensors 16 MB
Video streaming 26 MB

Multicast configuration

OctoMY™ uses multicast for local discovery:

Multicast address

  • Discovery group: 239.255.43.21
  • Port: Same as node type (8124 for Agent, etc.)

Enable multicast (Linux)

# Check multicast support
ip link show | grep MULTICAST

# Enable on interface
sudo ip link set eth0 multicast on

# Add multicast route (if needed)
sudo ip route add 239.255.0.0/16 dev eth0

Verify multicast

# Listen for multicast (on another machine)
socat UDP4-RECV:8124,ip-add-membership=239.255.43.21:eth0 -

# Send test multicast
echo "test" | socat - UDP4-DATAGRAM:239.255.43.21:8124

Quality of service (QoS)

For networks with QoS, OctoMY™ uses these DSCP values:

Traffic Type DSCP Priority
Control commands EF (46) Highest
Sensor data AF31 (26) High
Discovery BE (0) Normal

Configure router QoS

On your router, prioritize traffic to ports 8123-8126 with UDP protocol.


Connection timeouts

Configure timeout behavior:

Settings

Setting Default Description
Connection Timeout 10s Initial connection
Keepalive Interval 5s Ping frequency
Disconnect Timeout 30s Time before marking disconnected

Command line

./agent --personality MyRobot \
    --connection-timeout 15000 \
    --keepalive-interval 3000

Testing UDP connectivity

Basic port test

# On receiving side
nc -u -l 8124

# On sending side
echo "test" | nc -u <target-ip> 8124

Bidirectional test

# Terminal 1 (Agent side)
nc -u -l 8124 & echo "hello" | nc -u <remote-ip> 8125

# Terminal 2 (Remote side)
nc -u -l 8125 & echo "hello" | nc -u <agent-ip> 8124

Check for packet loss

# Send continuous test packets
while true; do echo "ping $(date)"; sleep 1; done | nc -u <target-ip> 8124

# Monitor on receiving end
nc -u -l 8124 | while read line; do echo "$line"; done

Common port conflicts

Find what's using a port

# Linux
sudo ss -ulnp | grep 8124

# Alternative
sudo lsof -i :8124

Common conflicts

Port Possible Conflict
8123 Polipo proxy
8124 Custom apps
8125 StatsD
8126 StatsD admin

Resolution

If ports conflict:

  1. Stop the conflicting service, or
  2. Use OctoMY's --port option to use different ports

Troubleshooting

"Address already in use"

# Find the process
sudo lsof -i :8124

# Kill it (if safe)
sudo kill -9 <PID>

# Or use a different port
./agent --port 9124

"Permission denied"

Ports below 1024 require root. OctoMY™ uses 8123+ by default to avoid this.

"Network unreachable"

# Check routing
ip route

# Ensure default gateway exists
ip route | grep default

In this section
Topics
howto connection UDP ports firewall configuration network
See also