RTL-SDR TCP Multiplexer
A TCP relay that allows multiple clients to connect to a single RTL-SDR device simultaneously.
While working with smart meter decoding, I needed a way to use a single RTL-SDR device for multiple simultaneous decoders. The existing rtl_mus solution had problems with CPU load and buffer crashes.
I wrote rtlmux to solve this problem, allowing multiple TCP clients to connect to a single RTL-SDR with about 1/4 the CPU usage of the alternative.
The Problem
RTL-SDR dongles are cheap and versatile software-defined radio receivers, but they have a fundamental limitation: one device, one client. If you want to decode multiple signals simultaneously—say, ADS-B aircraft tracking and APRS packets and smart meter data—you need multiple dongles. Or you need a multiplexer.
The existing solution (rtl_mus) worked, but it was a CPU hog and prone to buffer overflows under load. When you’re running this on a Raspberry Pi alongside other services, every bit of efficiency matters.
The Solution
rtlmux sits between the RTL-SDR device and multiple TCP clients. It:
- Reads the IQ data stream from the RTL-SDR once
- Replicates that stream to all connected clients
- Handles client connect/disconnect gracefully
- Forwards control commands (frequency changes, gain settings) to the device
- Does all this with minimal CPU overhead
The key insight was that most of rtl_mus’s CPU usage came from unnecessary data copying and poor buffer management. By being more careful about memory allocation and using efficient buffer ring structures, rtlmux achieves roughly 4x better performance.
Features
- Connect multiple TCP clients to a single RTL-SDR
- Low CPU overhead (~25% of rtl_mus)
- Replicates both data and control streams
- Clean disconnect handling
- Written in C for minimal dependencies
Usage
Usage information is in the README in the source repository.
See Also
- Amateur Radio hobby page - More about my SDR and ham radio activities
- AX.25 Packet Modem - Another radio project