AlexandreRouma / SDRPlusPlus

Cross-Platform SDR Software
GNU General Public License v3.0
4.17k stars 580 forks source link

RigCTL Server runs out of port when connecting several tens of thousands of times #1061

Open mgiugliano opened 1 year ago

mgiugliano commented 1 year ago

Hardware

Software

Bug Description The RigCTL Server crashes and can't be restarted by pressing the button that now reads "Start" (and no longer "stop").

Steps To Reproduce The server starts correctly and allows me to get and change the frequency, keeping it in sync, by a simple script written in bash or python (https://gist.github.com/mgiugliano/bb3e24abc1e27527863236ee64344155). After a while, while reading the frequency of the SDR++, the RigCTL server crashes and cannot be restarted without closing and relaunching the app.

Note: I resorted using nc instead of the rigctl client (e.g. by rigctl -v -m 2 -r localhost:4534 f) because the SDR++ server returns a strange error: rig_open: error = localhost:4534 Invalid argument. If I use echo and nc there is no error.

AlexandreRouma commented 1 year ago

Please provide SDR++ logs as requested in the issue template.

mgiugliano commented 1 year ago

@AlexandreRouma Thank you for your patience with me. I have omitted it as I thought it is required "Only If SDR++ fails to lauch or the SDR fails to start".

However the command line option "-c" does not work (see below)

/Applications/SDR++.app/Contents/MacOS/sdrpp -c [11/05/2023 18:29:59.000] [INFO] SDR++ v1.1.0 Unknown argument -a --addr Server mode address --autostart Automatically start the SDR after loading -h --help Show help -p --port Server mode port -r --root Root directory, where all config files are stored -s --server Run in server mode

Without the "-c" option, below is what I got on the stdout. I managed to crash the server, while SDR++ still running and this is the error message printed on stdout each time I tried clicking on the button "Start".

[11/05/2023 18:38:27.000] [ERROR] Could not start rigctl server: std::exception

Below the full output.

`

/Applications/SDR++.app/Contents/MacOS/sdrpp [11/05/2023 18:34:27.000] [INFO] SDR++ v1.1.0 [11/05/2023 18:34:27.000] [INFO] Loading config [11/05/2023 18:34:27.000] [WARN] ConfigManager locked, waiting... [11/05/2023 18:34:27.000] [INFO] Loading icons [11/05/2023 18:34:27.000] [INFO] Loading band plans [11/05/2023 18:34:27.000] [INFO] Loading band plans color table [11/05/2023 18:34:27.000] [INFO] Loading modules [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/rtl_sdr_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/meteor_demodulator.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/airspy_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/network_sink.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/scanner.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/plutosdr_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/sdrplay_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/radio.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/rigctl_server.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/audio_sink.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/m17_decoder.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/frequency_manager.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/recorder.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/file_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/bladerf_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/airspyhf_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/spyserver_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/rigctl_client.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/new_portaudio_sink.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/hermes_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/limesdr_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/discord_integration.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/rfspace_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/rtl_tcp_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/hackrf_source.dylib [11/05/2023 18:34:27.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Plugins/sdrpp_server_source.dylib [11/05/2023 18:34:27.000] [INFO] Initializing Airspy Source (airspy_source) [11/05/2023 18:34:27.000] [INFO] Initializing AirspyHF+ Source (airspyhf_source) [11/05/2023 18:34:27.000] [INFO] Initializing Audio Sink (audio_sink) [11/05/2023 18:34:31.000] [INFO] Initializing Audio Source (audio_source) [11/05/2023 18:34:31.000] [ERROR] Module 'audio_source' doesn't exist [11/05/2023 18:34:31.000] [INFO] Initializing BladeRF Source (bladerf_source) [11/05/2023 18:34:31.000] [ERROR] Could not list devices -7 [11/05/2023 18:34:31.000] [INFO] Initializing File Source (file_source) [11/05/2023 18:34:31.000] [INFO] Initializing Frequency Manager (frequency_manager) [11/05/2023 18:34:31.000] [INFO] Initializing HackRF Source (hackrf_source) [11/05/2023 18:34:31.000] [INFO] Initializing Hermes Source (hermes_source) [11/05/2023 18:34:31.000] [INFO] Initializing LimeSDR Source (limesdr_source) [11/05/2023 18:34:31.000] [INFO] Initializing Network Sink (network_sink) [11/05/2023 18:34:31.000] [INFO] Initializing PlutoSDR Source (plutosdr_source) [11/05/2023 18:34:31.000] [INFO] Initializing RFspace Source (rfspace_source) [11/05/2023 18:34:31.000] [INFO] Initializing RTL-SDR Source (rtl_sdr_source) [11/05/2023 18:34:31.000] [INFO] Initializing RTL-TCP Source (rtl_tcp_source) [11/05/2023 18:34:31.000] [INFO] Initializing Radio (radio) [Resamp] predec: 32, interp: 4, decim: 5, inacc: 0.000000%, taps: 380 [Resamp] predec: 4, interp: 96, decim: 125, inacc: 0.000000%, taps: 9500 [Resamp] predec: 2048, interp: 500, decim: 651, inacc: 0.000000%, taps: 49479 [Resamp] predec: 8192, interp: 16, decim: 1, inacc: 0.000000%, taps: 1216 [Resamp] predec: 8192, interp: 16, decim: 1, inacc: 0.000000%, taps: 1216 [11/05/2023 18:34:31.000] [WARN] Demod switch took 2397 us [11/05/2023 18:34:31.000] [INFO] Audio device open. [11/05/2023 18:34:31.000] [INFO] Initializing Recorder (recorder) [11/05/2023 18:34:31.000] [INFO] Initializing Rigctl Server (rigctl_server) [11/05/2023 18:34:31.000] [INFO] Initializing SDR++ Server Source (sdrpp_server_source) [11/05/2023 18:34:31.000] [INFO] Initializing SDRplay Source (sdrplay_source) [Resamp] predec: 512, interp: 1000, decim: 1953, inacc: 0.000000%, taps: 148437 [11/05/2023 18:34:31.000] [INFO] New DSP samplerate: 3000000.000000 (source samplerate is 3000000.000000) [11/05/2023 18:34:32.000] [INFO] Initializing SoapySDR Source (soapy_source) [11/05/2023 18:34:32.000] [ERROR] Module 'soapy_source' doesn't exist [11/05/2023 18:34:32.000] [INFO] Initializing SpyServer Source (spyserver_source) [11/05/2023 18:34:32.000] [INFO] Loading color maps [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/classic.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/inferno.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/turbo.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/vivid.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/gqrx.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/electric.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/plasma.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/greyscale.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/temper_colors.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/viridis.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/magma.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/smoke.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/websdr.json [11/05/2023 18:34:32.000] [INFO] Loading /Applications/SDR++.app/Contents/Resources/../Resources/colormaps/classic_green.json [Resamp] predec: 512, interp: 1000, decim: 1953, inacc: 0.000000%, taps: 148437 [11/05/2023 18:34:32.000] [INFO] New DSP samplerate: 3000000.000000 (source samplerate is 3000000.000000) [11/05/2023 18:34:32.000] [INFO] SDRPlaySourceModule 'SDRplay Source': Menu Select! [Resamp] predec: 512, interp: 1000, decim: 1953, inacc: 0.000000%, taps: 148437 [Resamp] predec: 512, interp: 1000, decim: 1953, inacc: 0.000000%, taps: 148437 [11/05/2023 18:34:32.000] [INFO] New DSP samplerate: 3000000.000000 (source samplerate is 3000000.000000) [Resamp] predec: 8192, interp: 16, decim: 1, inacc: 0.000000%, taps: 1216 [11/05/2023 18:34:33.000] [INFO] Audio device open. [11/05/2023 18:34:33.000] [INFO] SDRPlaySourceModule 'SDRplay Source': Tune: 8431684.221101! [11/05/2023 18:34:33.000] [INFO] Running post-init for Airspy Source [11/05/2023 18:34:33.000] [INFO] Running post-init for AirspyHF+ Source [11/05/2023 18:34:33.000] [INFO] Running post-init for Audio Sink [11/05/2023 18:34:33.000] [INFO] Running post-init for BladeRF Source [11/05/2023 18:34:33.000] [INFO] Running post-init for File Source [11/05/2023 18:34:33.000] [INFO] Running post-init for Frequency Manager [11/05/2023 18:34:33.000] [INFO] Running post-init for HackRF Source [11/05/2023 18:34:33.000] [INFO] Running post-init for Hermes Source [11/05/2023 18:34:33.000] [INFO] Running post-init for LimeSDR Source [11/05/2023 18:34:33.000] [INFO] Running post-init for Network Sink [11/05/2023 18:34:33.000] [INFO] Running post-init for PlutoSDR Source [11/05/2023 18:34:33.000] [INFO] Running post-init for RFspace Source [11/05/2023 18:34:33.000] [INFO] Running post-init for RTL-SDR Source [11/05/2023 18:34:33.000] [INFO] Running post-init for RTL-TCP Source [11/05/2023 18:34:33.000] [INFO] Running post-init for Radio [11/05/2023 18:34:33.000] [INFO] Running post-init for Recorder [11/05/2023 18:34:33.000] [INFO] Running post-init for Rigctl Server [11/05/2023 18:34:33.000] [INFO] Running post-init for SDR++ Server Source [11/05/2023 18:34:33.000] [INFO] Running post-init for SDRplay Source [11/05/2023 18:34:33.000] [INFO] Running post-init for SpyServer Source [11/05/2023 18:34:33.000] [INFO] Ready. [11/05/2023 18:34:42.000] [INFO] SDRPlaySourceModule 'SDRplay Source': Start! [11/05/2023 18:34:42.000] [INFO] SDRPlaySourceModule 'SDRplay Source': Tune: 8431684.221101! [11/05/2023 18:35:11.000] [INFO] Rigctl command: '\set_freq 7020950' [11/05/2023 18:35:12.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:13.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:15.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:16.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:17.000] [INFO] Rigctl command: '\set_freq 7018860' [11/05/2023 18:35:18.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:19.000] [INFO] Rigctl command: '\set_freq 7018560' [11/05/2023 18:35:20.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:21.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:22.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:23.000] [INFO] Rigctl command: '\set_freq 7016870' [11/05/2023 18:35:24.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:26.000] [INFO] Rigctl command: '\set_freq 7051870' [11/05/2023 18:35:27.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:28.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:29.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:30.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:31.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:32.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:33.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:35.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:36.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:37.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:38.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:39.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:40.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:41.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:43.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:44.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:45.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:46.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:47.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:48.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:49.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:51.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:52.000] [INFO] Rigctl command: '\set_freq 7958680' [11/05/2023 18:35:53.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:54.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:55.000] [INFO] Rigctl command: '\set_freq 9220370' [11/05/2023 18:35:56.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:35:57.000] [INFO] Rigctl command: '\set_freq 7946220' [11/05/2023 18:35:59.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:00.000] [INFO] Rigctl command: '\set_freq 9448820' [11/05/2023 18:36:01.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:02.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:03.000] [INFO] Rigctl command: '\set_freq 8432200' [11/05/2023 18:36:04.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:05.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:06.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:08.000] [INFO] Rigctl command: '\set_freq 7466470' [11/05/2023 18:36:09.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:10.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:11.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:12.000] [INFO] Rigctl command: '\set_freq 7100950' [11/05/2023 18:36:13.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:14.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:16.000] [INFO] Rigctl command: '\set_freq 7142480' [11/05/2023 18:36:17.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:18.000] [INFO] Rigctl command: '\set_freq 7177790' [11/05/2023 18:36:19.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:20.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:21.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:22.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:24.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:25.000] [INFO] Rigctl command: '\set_freq 7467510' [11/05/2023 18:36:26.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:27.000] [INFO] Rigctl command: '\set_freq 8432200' [11/05/2023 18:36:28.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:29.000] [INFO] Rigctl command: '\set_freq 9253590' [11/05/2023 18:36:30.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:32.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:33.000] [INFO] Rigctl command: '\set_freq 9360550' [11/05/2023 18:36:34.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:35.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:36.000] [INFO] Rigctl command: '\set_freq 9462320' [11/05/2023 18:36:37.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:39.000] [INFO] Rigctl command: '\set_freq 9638850' [11/05/2023 18:36:40.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:41.000] [INFO] Rigctl command: '\set_freq 9675190' [11/05/2023 18:36:42.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:43.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:44.000] [INFO] Rigctl command: '\set_freq 7294090' [11/05/2023 18:36:45.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:46.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:48.000] [INFO] Rigctl command: '\set_freq 7077060' [11/05/2023 18:36:49.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:50.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:51.000] [INFO] Rigctl command: '\set_freq 7574470' [11/05/2023 18:36:52.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:53.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:54.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:56.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:57.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:58.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:36:59.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:00.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:01.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:02.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:04.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:05.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:06.000] [INFO] Rigctl command: '\set_freq 7582220' [11/05/2023 18:37:07.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:08.000] [INFO] Rigctl command: '\set_freq 7623650' [11/05/2023 18:37:09.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:10.000] [INFO] Rigctl command: '\set_freq 7661900' [11/05/2023 18:37:11.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:12.000] [INFO] Rigctl command: '\set_freq 7689180' [11/05/2023 18:37:13.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:15.000] [INFO] Rigctl command: '\set_freq 7755000' [11/05/2023 18:37:16.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:17.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:18.000] [INFO] Rigctl command: '\set_freq 7800000' [11/05/2023 18:37:19.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:20.000] [INFO] Rigctl command: '\set_freq 7835000' [11/05/2023 18:37:21.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:22.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:23.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:24.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:26.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:27.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:28.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:29.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:30.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:31.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:32.000] [INFO] Rigctl command: '\set_freq 7870000' [11/05/2023 18:37:33.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:34.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:36.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:37.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:38.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:39.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:40.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:41.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:42.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:44.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:45.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:46.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:47.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:48.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:49.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:50.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:52.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:53.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:54.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:37:55.000] [INFO] Rigctl command: '\get_freq' [11/05/2023 18:38:09.000] [INFO] Rigctl command: '\set_freq 7870000.0' [11/05/2023 18:38:09.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:09.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:09.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:09.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:09.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:09.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:10.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:10.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:10.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:10.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:10.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:10.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:10.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\set_freq 7869570.0' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\set_freq 7867500.0' [11/05/2023 18:38:11.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\set_freq 7865000.0' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\set_freq 7861800.0' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\set_freq 7858270.0' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\set_freq 7854940.0' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\set_freq 7851480.0' [11/05/2023 18:38:12.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\set_freq 7847820.0' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\set_freq 7843820.0' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\set_freq 7839740.0' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\set_freq 7835760.0' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\set_freq 7830950.0' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\set_freq 7827080.0' [11/05/2023 18:38:13.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\set_freq 7822060.0' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\set_freq 7817160.0' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\set_freq 7812480.0' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\set_freq 7807620.0' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\set_freq 7802860.0' [11/05/2023 18:38:14.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\set_freq 7798110.0' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\set_freq 7793330.0' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\set_freq 7789360.0' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\set_freq 7786180.0' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\set_freq 7782630.0' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\set_freq 7782450.0' [11/05/2023 18:38:15.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\set_freq 7782220.0' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\set_freq 7780250.0' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\set_freq 7778960.0' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\set_freq 7775670.0' [11/05/2023 18:38:16.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:17.000] [INFO] Rigctl command: '\set_freq 7771230.0' [11/05/2023 18:38:17.000] [INFO] Rigctl command: '\get_freq ' [11/05/2023 18:38:17.000] [INFO] Rigctl command: '\set_freq 7768510.0' [11/05/2023 18:38:27.000] [ERROR] Could not start rigctl server: std::exception [11/05/2023 18:38:31.000] [ERROR] Could not start rigctl server: std::exception [11/05/2023 18:38:35.000] [ERROR] Could not start rigctl server: std::exception [11/05/2023 18:38:35.000] [ERROR] Could not start rigctl server: std::exception [11/05/2023 18:38:47.000] [INFO] SDRPlaySourceModule 'SDRplay Source': Stop! [11/05/2023 18:38:48.000] [INFO] SDRPlaySourceModule 'SDRplay Source': Start! [11/05/2023 18:38:48.000] [INFO] SDRPlaySourceModule 'SDRplay Source': Tune: 8431684.221101! 2023-05-11 18:38:48.670 sdrpp[8607:375860] CoreText: System LastResort not available, using built-in copy. [11/05/2023 18:38:50.000] [INFO] Exiting successfully `

AlexandreRouma commented 1 year ago

I see the issue, but it stems from a misuse of the protocol by your script.

Every single time you get or set the frequency, you open a new connection to the server. This is not only slow but requires the OS to allocate a new port for the software to use. When the client disconnects after running the command, the OS does not immediately allow the re-use of the client port, it waits for a bit in case the third packet of the 3 way TCP disconnect handshake arrives late. Since your script connects and disconnects 50 times per second, the number of free ports quickly runs out...

I think there might be a work around but I'll have to look into the side effects.

In the mean time, you can edit your script to use rigctl as it's actually indended to be used. You connect once and issue commands one after the other without disconnecting.

mgiugliano commented 1 year ago

Thank you for the time you spent on it!

I resorted to "nc" netcast precisely because rigctl was NOT working. As I wrote in my first post here,

rigctl -v -m 2 -r localhost:4534 f

returned a strange error: rig_open: error = localhost:4534 Invalid argument. I am puzzled with it, as I a using rigctl with rigctld (controlling my USB transceiver without problems)

The fact that nc worked suggested that maybe there was something I did not understand on the syntax of rigctl.

Any advice from you would be precious.

AlexandreRouma commented 1 year ago

The issue isn't with netcat. Calling the rigctl command repeatedly would result in the exact same issue. Just run netcat or rigctl continously and give it commands via it's stdin/stdout. (or better, just use python sockets).

For the rigctl error, it's because rigctl sends unsupported commands to SDR++ like \get_powerstat which are not supported because SDR++ only currently supports a subset of commands. It wasn't really meant to be used with hamlib directly, it was meant originally for software like gpredict that send commands directly themselves.

So again, I recommend you use python sockets to issue commands manually instead. The rigctl protocol was made to be usable that way, read their documentation. You just need to send the command followed by a newline character and then read a line that'll correspond to the response.

mgiugliano commented 1 year ago

BTW: I am not really sure the part of the code (you correctly criticised) is de facto executed 50 time/s, since the "echo | nc" has some lag to execute and return.

From the stdout it seems at most ~10 time/s when I kept acting on the (physical) VFO of my radio.

Thank you again for your time.

AlexandreRouma commented 1 year ago

The delay in the code is set to 20ms = 50Hz. The additional delay caused by the commands is hardware specific.

lwvmobile commented 1 year ago

Just as a casual aside, I've coded DSD-FME to make extensive use (abuse) of the RigCTL server and TCP Network Sink in SDR++, and depending on system type, I can hammer the RigCTL server with a get_freq request once every 80ms (NXDN SRV_INFO frame), send set_freq requests and tune around, and keep an incoming audio stream from TCP running all the same time, and SDR++ rock solid, no issues, whatsoever. On one of my remote locations, its been running for weeks at a time without issue and without disconnect, I often forget its running at all.

AlexandreRouma commented 1 year ago

yes as long as you keep the connection continuous there is no limit to the frequency at which you can run commands.

mgiugliano commented 1 year ago

So all in all, apologies for my inexperience.

However, I did not get it: is it a bug or not that SDR++'s server can't be restarted after it fails?

mgiugliano commented 1 year ago

@lwvmobile Thanks for the heads up!

Do you think it might be sufficient for the case study of my own "sync" demo, to use/get inspiration from your "dsd_rigctl.c"?

lwvmobile commented 1 year ago

Do you think it might be sufficient for the case study of my own "sync" demo, to use/get inspiration from your "dsd_rigctl.c"?

If you want to, to be honest, a lot of what is in dsd_rigctl.c came from gqrx_scanner originally, but the general idea is just to connect to the TCP socket, and leave the connection open. Don't close the connection unless you close your software. Then, with it remaining open constantly, send whichever rigctl commands you want to (GetCurrentFreq or SetFreq, etc) and read the return.

mgiugliano commented 1 year ago

Thank you @lwvmobile and @AlexandreRouma for guidance and patience with my ignorance.

For posterity, here is a working solution (written in C) that does NOT crash SDR++ server - https://github.com/mgiugliano/syncSDRpp

AlexandreRouma commented 1 year ago

I'll still leave this open in case the work around I was thinking of is valid

sq2mo commented 4 months ago

The thread here seems to be close enough to ask a question: Does rigctl server serve only one connection? My experience is: while one client is connected, subsequent clients are not being served nor replied.

AlexandreRouma commented 4 months ago

the server is single client only

sq2mo commented 4 months ago

Any plans to fix this in the nearest future?

AlexandreRouma commented 4 months ago

no