×
INDI Library v1.8.5 Released (19 Apr 2020)

April 2020 release of INDI Library v1.8.5 introduces new drivers while providing fixes and improvements to existing devices and core framework.

How to connect to INDI server with software sockets

4 months 3 weeks ago
Willems
Fresh Boarder
Fresh Boarder
Posts: 4
More
Topic Author
How to connect to INDI server with software sockets #50653
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

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

4 months 3 weeks ago
knro
Administrator
Administrator
Posts: 8186
Karma: 51
How to connect to INDI server with software sockets #50662
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!

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
The following user(s) said Thank You pug916

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

4 months 3 weeks ago
Willems
Fresh Boarder
Fresh Boarder
Posts: 4
More
Topic Author
How to connect to INDI server with software sockets #50664
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

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

4 months 3 weeks ago
knro
Administrator
Administrator
Posts: 8186
Karma: 51
How to connect to INDI server with software sockets #50665
No authentication, just a regular network TCP/IP socket. Make sure you are connecting to the correct port (default 7624).

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

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

4 months 3 weeks ago
Willems
Fresh Boarder
Fresh Boarder
Posts: 4
More
Topic Author
How to connect to INDI server with software sockets #50672
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).

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

4 months 3 weeks ago
knro
Administrator
Administrator
Posts: 8186
Karma: 51
How to connect to INDI server with software sockets #50699
Any firewall blocking port 7624 perhaps?

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

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

4 months 3 weeks ago
gilesco
Expert Boarder
Expert Boarder
Posts: 101
Karma: 1
More
How to connect to INDI server with software sockets #50702
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.

__
I blog my progress: www.coochey.net

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

4 months 3 weeks ago
Willems
Fresh Boarder
Fresh Boarder
Posts: 4
More
Topic Author
How to connect to INDI server with software sockets #50713
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.

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

Time to create page: 0.526 seconds