High performant TCP server for rtl-sdr

Overview

About Build Status Quality Gate Status

design

Key features

  • Share available RF bandwidth between several independent clients:
    • Total bandwidth can be 2016000 samples/sec at 436,600,000 hz
    • One client might request 48000 samples/sec at 436,700,000 hz
    • Another client might request 96000 samples/sec at 435,000,000 hz
  • Several clients can access the same band simultaneously
  • Output saved onto disk or streamed back via TCP socket
  • Output can be gzipped (by default = true)
  • Output will be decimated to the requested bandwidth
  • Clients can request overlapping RF spectrum
  • Rtl-sdr starts only after first client connects (i.e. saves solar power &etc). Stops only when the last client disconnects
  • MacOS and Linux (Debian Raspberrypi)

Design

design

API

  • Defined in the api.h
  • Clients can connect and send request to initiate listening:
    • center_freq - this is required center frequency. For example, 436,700,000 hz
    • sampling_rate - required sampling rate. For example, 48000
    • band_freq - first connected client can select the center of the band. All other clients should request center_freq within the currently selected band
    • destination - "0" - save into file on local disk, "1" - stream back via TCP socket
  • To stop listening, clients can send SHUTDOWN request or disconnect

Queue

design

The data between rtl-sdr worker and the dsp workers is passed via queue. This is bounded queue with pre-allocated memory blocks. It has the following features:

  • Thread-safe
  • If no free blocks (consumer is slow), then the last block will be overriden by the next one
  • there is a special detached block. It is used to minimize synchronization section. All potentially long operations on it are happening outside of synchronization section.
  • Consumer will block and wait until new data produced

Configuration

Sample configuration can be found in tests:

https://github.com/dernasherbrezon/sdr-server/blob/main/test/resources/configuration.config

Performance

Is good. Some numbers in test/perf_xlating.c

Dependencies

sdr-server depends on several libraries:

  • libvolk. It is recommended to use the latest version (Currently it is 2.x). After libvolk installed or built, it needs to detect optimal kernels. Run the command volk_profile to generate and save profile.
  • librtlsdr. Version >=0.5.4 is required.
  • libconfig
  • libz. Should be installed in every operational system
  • libm. Same
  • libcheck for tests (Optional)

All dependencies can be easily installed using the command:

sudo apt-get install libvolk2-dev librtlsdr-dev libconfig-dev check

Build

To build the project execute the following commands:

mkdir build
cd build
cmake ..
make
Comments
  • test_core segfaults

    test_core segfaults

    Hi

    I just wanted to try this out and was just mucking around. I noticed that the check package is noted optional as currently mentioned in the readme, but cmake requires it when configuring -- so I just installed it and I built it all successfully.

    Because I installed check I just tried to run the test binaries, but test_core segfaults for me:

    [email protected] build]$ ./test_core 
    Running suite(s): core
    loading configuration from: core.config
    bias-t: 0
    gain mode: 1
    gain: 4.200000
    ppm: 10
    queue_size: 64
    band sampling rate: 48000
    buffer size: 131072
    lpf_cutoff_rate: 24
    start listening on 127.0.0.1:8089
    read timeout 5s
    base path for storing results: /tmp
    using gzip: 0
    rtl-sdr is starting
    the actual nearest supported gain is: 4.300000
    [0] dsp_worker is starting
    [1] dsp_worker is starting
    [1] dsp_worker is stopping
    [1] dsp_worker stopped
    rtl-sdr is stopping
    rtl-sdr stopped
    [0] dsp_worker is stopping
    [0] dsp_worker stopped
    checking: /tmp/0.cf32
    checking: /tmp/1.cf32
    loading configuration from: core.config
    bias-t: 0
    gain mode: 1
    gain: 4.200000
    ppm: 10
    queue_size: 64
    band sampling rate: 48000
    buffer size: 131072
    lpf_cutoff_rate: 24
    start listening on 127.0.0.1:8089
    read timeout 5s
    base path for storing results: /tmp
    using gzip: 0
    <3>cutoff frequency should be positive and less than sampling freq / 2. got: 24500
    [0] dsp_worker is stopping
    Segmentation fault (core dumped)
    [[email protected] build]$ coredumpctl gdb
    <<<snip>>>
    Core was generated by `./test_core'.
    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  0x00007f3712f67662 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
    (gdb) bt
    #0  0x00007f3712f67662 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
    #1  0x00005644077aa04b in destroy_node ()
    #2  0x00005644077aa1f2 in add_client ()
    #3  0x00005644077ab891 in test_invalid_lpf_config_fn ()
    #4  0x00007f3713460b82 in ?? () from /usr/lib/libcheck.so.0
    #5  0x00007f37134611a2 in srunner_run_tagged () from /usr/lib/libcheck.so.0
    #6  0x00005644077ac48d in main ()
    quit) 
    [[email protected] build]$ git describe  --tags
    1.0.0-68-gb9cf76f
    
    opened by nickoe 7
  • Multi-User Behaviour Questions

    Multi-User Behaviour Questions

    In your documentation you mention: "first connected client can select the center of the band. All other clients should request center_freq within the currently selected band"

    Is there any way for a connected client to know the current receiver centre frequency? Or will an error be reported if the requested downconversion frequency is outside of the available bandwidth?

    As an addendum to this - could the server perhaps re-adjust the centre frequency of the SDR to accomodate a new user requesting a frequency just outside of the currently available bandwidth? This would of course result in glitch in the IQ output of other users as the SDR is re-tuned, but that's unavoidable.

    My application for this server is in the radiosonde_auto_rx project, where at the moment to receive multiple radiosondes I need multiple RTLSDRs, as I'm just using rtl_fm to do the downconversion (and in some cases, FM demodulation, though mostly I use 48 / 96 kHz IQ). I also make use of rtl_power to grab a spectrum snapshot for peak detection, but this could fairly easily be implemented using another utility to capture a few seconds of full-bandwidth IQ data and perform a FFT.

    opened by darksidelemm 5
  • Compiling issue - rtlsdr_set_bias_tee

    Compiling issue - rtlsdr_set_bias_tee

    On a updated debian/buster i get:

    [ 67%] Linking C executable sdr_server /usr/bin/ld: libsdr_serverLib.a(core.c.o): in function start_rtlsdr': core.c:(.text+0x54c): undefined reference tortlsdr_set_bias_tee' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/sdr_server.dir/build.make:89: sdr_server] Error 1 make[1]: *** [CMakeFiles/Makefile2:258: CMakeFiles/sdr_server.dir/all] Error 2 make: *** [Makefile:141: all] Error 2

    Old rtl-lib? minimum version to run?

    apt-cache show librtlsdr-dev | grep Version Version: 0.6-1

    opened by sm3ulc 4
  • [Request] SDR Console

    [Request] SDR Console

    Is the sdr-server not compatible with SDR Console via rtl_tcp ??

    Getting <3>[0] unsupported protocol: 8

    If using only rtl_tcp SDR Console is running fine

    Best Tim

    opened by SA7BNT 1
  • sdr-server clients

    sdr-server clients

    Hello,

    Could you please provide some information about sdr-server's clients? How to connect to the sdr-server? I tried CubicSDR and GQRX on macOS but there is no connection to the sdr-server.

    Thanks, Alex

    opened by atlex 1
  • libvolk2 in very few distributions

    libvolk2 in very few distributions

    Just comment. Maybe add instructions of how install libvolk2 since it's not included yet.

    Fetch latest release: https://www.libvolk.org/releases.html

    Install mako: sudo apt-get install python3-mako

    Normal build procedure:

    $ mkdir build $ cd build $ cmake .. $ make $ make test $ sudo make install

    opened by sm3ulc 1
  • [Request] make SDR-Server work with HackRF and/or SoapySDR

    [Request] make SDR-Server work with HackRF and/or SoapySDR

    Greetings,

    I would LOVE if I could take this SDR-server over to Pluto's, HackRF's, BladeRF's, and more. And especially so, since these SDR's can generate a much wider waveform and would greatly benefit to splitting them up and processing remotely.

    opened by jwcrawley 1
Owner
dernasherbrezon
Engineer
dernasherbrezon
an easy implementation of a multi-process tcp server and a multi-thread tcp client

一个TCP多进程服务器-多线程客户端的简单实现。 客户端类似Apache ab的测试功能,能够通过向某一个ip端口发送指定并发量和总数量的tcp短连接;服务端处理tcp短连接,每来一条消息就打印一条log。 使用cmake编译,建议在vscode里编译,或者命令行 # 终端进入目录 mkdir bu

adin 1 Nov 28, 2021
Windows named pipe server that forwards connections to given TCP server

PipeTcp An asynchronous Windows named pipe server that forwards connections to given TCP server. Pre-built binaries can be found in Releases. Invocati

Jinoh Kang 4 May 23, 2022
Open source SDR 4G/5G software suite from Software Radio Systems (SRS)

Open source SDR 4G/5G software suite from Software Radio Systems (SRS)

srsRAN 2.8k Sep 20, 2022
a lightweight and performant multicast DNS (mDNS) reflector with modern design, supports zone based reflection and IPv6

mDNS Reflector mDNS Reflector (mdns-reflector) is a lightweight and performant multicast DNS (mDNS) reflector with a modern design. It reflects mDNS q

Yuxiang Zhu 74 Sep 6, 2022
A modern C++ network library for developing high performance network services in TCP/UDP/HTTP protocols.

evpp Introduction 中文说明 evpp is a modern C++ network library for developing high performance network services using TCP/UDP/HTTP protocols. evpp provid

Qihoo 360 3.1k Sep 22, 2022
Brynet - Header Only Cross platform high performance TCP network library using C++ 11.

Brynet Header Only Cross platform high performance TCP network library using C++ 11. Build status Windows : Linux/MacOS : Features Header only Cross p

IronsDu 861 Sep 21, 2022
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution

CppServer Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and

Ivan Shynkarenka 885 Sep 17, 2022
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 8.7k Sep 18, 2022
A barebones TCP server framework in POSIX C

TCP Server Framework A barebones TCP Server Framework in POSIX C; removes boilerplate code and uses loop paradigm. How To Use copy files into project

null 1 Oct 4, 2021
Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

null 1 Jun 22, 2022
Provide translation, currency conversion, and voting services. First using telnet you create a connection to a TCP socket, then the server connects to 3 UDP sockets hosted on other servers to do tasks.

to run micro servers g++ translator.cpp -o translator ./translator <port 1> g++ voting.cpp -o voting ./voting <port 2> g++ currency_converter.cpp -o c

Jacob Artuso 1 Oct 29, 2021
IRC server based on TCP/IP protocol to rfc1459 standard

IRC-server В далеком 1998 году, в сети DALnet, на одном популярном тогда русскоязычном канале, на вопрос новичка «А что такое IRC?», один человек отве

Sergey Gorbachev 29 Sep 15, 2022
Simple Tcp Chat Client / Server written in C++

What this TcpXat TcpXat Is A Simple Tcp Chat Setup TcpXat sudo apt install make;make client;make serv;echo "done by FuryM3m0ry"; How To Run TcpXat Ter

sami 1 Dec 28, 2021
Boilerplate of a TCP Server written in C++ using the epoll API

tcp-server-boilerplate Boilerplate of a TCP Server written in C++ using the epoll API. Requirements cmake (if you want to use the provided build.sh sc

Leonardo Folgoni 20 Jan 23, 2022
High performance server-side application framework

Seastar Introduction SeaStar is an event-driven framework allowing you to write non-blocking, asynchronous code in a relatively straightforward manner

ScyllaDB 6.9k Sep 22, 2022
A cross-platform network learning demos. Like high-performance http server

Network-Learn A cross-platform network learning demos (toys). And I try not to use 3rd-party libraries. Welcome to try it out and leave your comments.

Ho 229 24 Sep 6, 2022
LAppS - Lua Application Server for micro-services with default communication over WebSockets. The fastest and most vertically scalable WebSockets server implementation ever. Low latency C++ <-> Lua stack roundtrip.

LAppS - Lua Application Server This is an attempt to provide very easy to use Lua Application Server working over WebSockets protocol (RFC 6455). LApp

null 47 Apr 25, 2022
A project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server.

PS4 Server 9.00 This is a project designed for the esp8266 D1 Mini or the esp8266 D1 Mini PRO to provide a wifi http server and dns server. this is fo

null 13 Sep 7, 2022
mTCP: A Highly Scalable User-level TCP Stack for Multicore Systems

README mTCP is a highly scalable user-level TCP stack for multicore systems. mTCP source code is distributed under the Modified BSD License. For more

null 1.8k Sep 22, 2022