All Docs

UDP Setup Guide

This guide covers the detailed setup of your UDP listener, including firewall configuration, performance tuning, and code examples in multiple languages.

Firewall Configuration

Ensure your assigned UDP port is open for inbound traffic from ShredStream.com servers.

bash
# UFW (Ubuntu)
sudo ufw allow 8001/udp
# iptables
sudo iptables -A INPUT -p udp --dport 8001 -j ACCEPT
# firewalld (CentOS/RHEL)
sudo firewall-cmd --permanent --add-port=8001/udp
sudo firewall-cmd --reload

UDP Buffer Tuning

For high-throughput shred reception, increase your system's UDP buffer sizes:

bash
# Increase UDP receive buffer (Linux)
sudo sysctl -w net.core.rmem_max=26214400
sudo sysctl -w net.core.rmem_default=26214400
# Make persistent
echo 'net.core.rmem_max=26214400' | sudo tee -a /etc/sysctl.conf
echo 'net.core.rmem_default=26214400' | sudo tee -a /etc/sysctl.conf

Listener Examples

Below are production-ready UDP listener implementations in Python, Rust, and JavaScript.

import socket
import struct
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 26214400)
sock.bind(("0.0.0.0", 8001))
print("Listening for Solana shreds on port 8001...")
count = 0
while True:
data, addr = sock.recvfrom(1280)
count += 1
if count % 1000 == 0:
print(f"Received {count} shreds ({len(data)} bytes each)")
ShredStream.com — Fastest Solana Shred Streaming