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# iptablessudo iptables -A INPUT -p udp --dport 8001 -j ACCEPT# firewalld (CentOS/RHEL)sudo firewall-cmd --permanent --add-port=8001/udpsudo 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=26214400sudo sysctl -w net.core.rmem_default=26214400# Make persistentecho 'net.core.rmem_max=26214400' | sudo tee -a /etc/sysctl.confecho '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 socketimport structsock = 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 = 0while True:data, addr = sock.recvfrom(1280)count += 1if count % 1000 == 0:print(f"Received {count} shreds ({len(data)} bytes each)")