API TCP/IP Commands

  • 1
  • Question
  • Updated 2 months ago
I am trying to figure out a way using the SmartSDR TCP/IP API commands to determine if the radio has a client running SmartSDR.   

After I telnet into the radio I can use the command c21|sub tx all to see what frequency  the client is using.  However this value remains persisted and even if the SmartSDR session is terminated the value remains.   The only other solution I see is to use the C41|List Slice command and then parse out the active or inactive slices to determine if the SmartSDR session is terminated.  

The Wiki page appears to have old data on it and I am hoping that maybe there is a command to see if a SmartSDR client is connected to the radio.   

Thanks,

Mike, W8BE
Photo of Mike, W8BE

Mike, W8BE

  • 168 Posts
  • 38 Reply Likes

Posted 2 months ago

  • 1
Photo of Andreas Junge

Andreas Junge, Elmer

  • 55 Posts
  • 5 Reply Likes
Mike,

the easiest for your purpose would be to listen on port 4992 UDP. The radio broadcasts this information in the discovery packet once a second.

If you telnet in to the radio then there also is a "sub client all" and "sub radio all" and you can piece it together. 

73, Andreas. N6NU
Photo of Mike, W8BE

Mike, W8BE

  • 168 Posts
  • 38 Reply Likes
Andreas,

Thanks... I will look into how to listen for UDP packets.

Mike
Photo of Mark WS7M

Mark WS7M

  • 505 Posts
  • 149 Reply Likes
Mike,  Not sure if you are on 3.x yet or not.  But in 3.x there is a client list you can obtain which is related to the MULTI-Flex operation.   

The SmartSDR API provided by Flex provides this list.  I'm not directly sure of the TCP/IP command that gets that same list though.
Photo of Mike, W8BE

Mike, W8BE

  • 168 Posts
  • 38 Reply Likes
Mark,

That is great.  Can it be accessed via telnet?  I am doing this on a raspberry Pi and am not a programmer so trying to keep it as simple as possible.  

thanks again.

Mike
Photo of Mark WS7M

Mark WS7M

  • 505 Posts
  • 149 Reply Likes
Mike,

I am sure the client list can be obtained using some TCP call.  That is how the API does it.  I just do not know the thing to look for.

What I would do, if you can, is setup WireShark to monitor traffic on the TCP/IP port between the radio and a computer.   On the computer you could use a program like Putty if you wish to issue commands to the radio.

But first I would Wireshark a normal SSDR 3.x connection to the radio.  When you can examine the commands and responses and probably pretty easy to find the one that will give you the client list.

Mark
Photo of Andreas Junge

Andreas Junge, Elmer

  • 55 Posts
  • 5 Reply Likes
#!/usr/bin/env python

import socket


addr = ('255.255.255.255', 4992)                          # broadcast address explicitly


s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # Create socket

s.bind(('',4992))



# Almost infinite loop... ;)

while True:

  m=s.recvfrom(4096)

  print m


UDPSock.close()             # Close socket

print 'Client stopped.'


Photo of Mike, W8BE

Mike, W8BE

  • 168 Posts
  • 38 Reply Likes
Thank Andreas.   I will put that to work.

Mike