×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

How to connect to INDI server with software sockets

  • Posts: 6
  • Thank you received: 1
Hi,

I'm trying to connect to a INDIServer that runs on my Raspberry pi zero W on the default port from software (Swift on Mac OS).
Unfortunately I am not that familiar with socket programming so my question might be somewhat basic.
What kind of socket (or what kind of protocol) do I need to connect to the INDI server. I've tried TCP and HTTP sockets, but they do not seem to work. I get a permission denied error. At first I'm just trying to send <getProperties version="1.7"/> to the server.

I am able to connect to the server from kStars running on my Mac.

Thanks,
Don
4 years 2 weeks ago #50653

Please Log in or Create an account to join the conversation.

Hello Mike,

Welcome to INDI forums. To communicate with INDI server, you just need to communicate with it using TCP/IP over Port 7624 (which is default, but INDI server can be configured to run on a different port). An a quick is to do this. In one terminal, run INDI server:
indiserver -v indi_simulator_telescope

You should get an output like this:
2020-03-12T06:28:20: startup: indiserver -v indi_simulator_telescope 
2020-03-12T06:28:20: Driver indi_simulator_telescope: pid=15638 rfd=3 wfd=6 efd=7
2020-03-12T06:28:20: listening to port 7624 on fd 4
2020-03-12T06:28:20: Driver indi_simulator_telescope: snooping on GPS Simulator.GEOGRAPHIC_COORD
2020-03-12T06:28:20: Driver indi_simulator_telescope: snooping on GPS Simulator.TIME_UTC
2020-03-12T06:28:20: Driver indi_simulator_telescope: snooping on Dome Simulator.DOME_PARK
2020-03-12T06:28:20: Driver indi_simulator_telescope: snooping on Dome Simulator.DOME_SHUTTER

Then on another terminal, telnet to the server:
telnet localhost 7624

Then I typed in this and pressed enter:
<getProperties version='1.7'/>

Then you should see a list of properties back:
jasem@jasem-neon:~$ telnet localhost 7624
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
<getProperties version='1.7'/>
<defSwitchVector device="Telescope Simulator" name="CONNECTION" label="Connection" group="Main Control" state="Idle" perm="rw" rule="OneOfMany" timeout="60" timestamp="2020-03-12T06:29:19">
    <defSwitch name="CONNECT" label="Connect">
Off
    </defSwitch>
    <defSwitch name="DISCONNECT" label="Disconnect">
...etc

Hope this helps!
The following user(s) said Thank You: Craig
4 years 2 weeks ago #50662

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 1
Yes, I was able to do all that. My problem is that I cannot connect using sockets from my own program.
I get a permission denied error back so that might mean that the port is not open. But then why am I able to connect using kStars?
I assume that no authentication is needed?

Thanks
4 years 2 weeks ago #50664

Please Log in or Create an account to join the conversation.

No authentication, just a regular network TCP/IP socket. Make sure you are connecting to the correct port (default 7624).
4 years 2 weeks ago #50665

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 1
I seem to be able to connect with nc:

$ nc pizero.local 7624 -vz
nc -vz pizero.local 7624
nc: connectx to pizero.local port 7624 (tcp) failed: Connection refused
nc: connectx to pizero.local port 7624 (tcp) failed: Connection refused
Connection to pizero.local port 7624 [tcp/indi] succeeded!

As you can see, the connection is first refused twice and succeeds the third time.
If I try to connect from software, the connection gets refused (TCP error 61).
4 years 2 weeks ago #50672

Please Log in or Create an account to join the conversation.

Any firewall blocking port 7624 perhaps?
4 years 2 weeks ago #50699

Please Log in or Create an account to join the conversation.

  • Posts: 348
  • Thank you received: 69
If on another terminal you run "tcpdump -s0 -w capture.pcap"

Then run your netcat command

Afterwards you can CTRL-C the tcpdump process and you will have a packet capture file to look at.

You can then check the pcap file with something like wireshark.

Out of interest, what if you run netcat with the -4 option?, just thinking it might be resolving pizaro.local with a link local IPv6 address, and indi might only be listening on the IPv4 address.

Alternatively, perhaps just use the IPv4 address directly with netcat?

Clutching at straws, I know.
4 years 2 weeks ago #50702

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 1
I've been able to get it working. Unfortunately I don't really know what the problem was. There was a timing issue but I don't think that is the whole story. Anyway, I can now send the <getProperties version="1.7"> string and get the appropriate response back in software.
Thanks for thinking with me.
4 years 2 weeks ago #50713

Please Log in or Create an account to join the conversation.

Time to create page: 1.226 seconds