×

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

Bi-monthly release with minor bug fixes and improvements

TCP / UDP connections

  • Posts: 8
  • Thank you received: 1
Hello,

I've noticed some kind of UDP support has been added recently; I don't manage to get the standard "tty_read" and "tty_write" to work with it.

Looking at connectiontcp.cpp code, it is a bit confusing to see it calling a "connect" for an UDP connection - and no "bind".
It's common for UDP clients to:
- open the socket
- bind with address NULL
- perform "sendto"s
(other alternatives maybe sendto/recvfrom...)

I intended to add some code to improve this, but not sure of the approach. Also I don't know if there's any other code using the UDP as it is now? (I don't see how...)

I'll be glad to code it if a convenient approach is found.

Thanks again,

jaime
6 years 4 months ago #21232

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

  • Posts: 63
  • Thank you received: 6

Replied by Eric Vickery on topic TCP / UDP connections

I am the one who added UDP support. It is used in the Gemini telescope driver.

The UDP support was not designed to be a server or to do broadcast messages, just as an alternate way to connect other than TCP.
The following user(s) said Thank You: Jasem Mutlaq, Jaime Alemany
6 years 4 months ago #21244

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

  • Posts: 8
  • Thank you received: 1

Replied by Jaime Alemany on topic TCP / UDP connections

Thanks, that's the same I intend to do, so I'll check the Gemini telescope driver to see how you did it! :-)
6 years 4 months ago #21245

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

  • Posts: 8
  • Thank you received: 1

Replied by Jaime Alemany on topic TCP / UDP connections

After digging a bit I still don't get how you manage to receive messages using the standard tty_read functions - as far as I know a bind or recvfrom is required, and I find none!

In my tests, using the code "as is", I can get data sent to destination, but nothing received.

Enlightenment, pleaseeee?

(I must say I'm a bit surprised of finding gemini specific code in the indicom files - I can understand sometimes there's no other way, though)

Thanks
6 years 4 months ago #21262

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

  • Posts: 63
  • Thank you received: 6

Replied by Eric Vickery on topic TCP / UDP connections


Sorry for the delayed response. The Thanksgiving holiday kept me busy.

I think the ::connect() call on line 140 in connectiontcp.cpp handles the bind if the socket type is STREAM. Other than that sockets works basically the same whether it is a STREAM or DATA_GRAM socket.

I didn't really want to put Gemini specific code in indicom.c but I didn't want to duplicate all the tty code either. So I decided that a bit of Gemini specific code in indicom.c was the lesser of two evils.
The following user(s) said Thank You: Jaime Alemany
6 years 4 months ago #21337

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

  • Posts: 8
  • Thank you received: 1

Replied by Jaime Alemany on topic TCP / UDP connections

Thanks, hope you had a great Thanksgiving!

Yes, the ::connect is definitely doing something (it's called also for UDP), but as far as I know this should only set the default destination address:port.

In fact I'm able to send, and my equipment receives, packets using the standard tty_write... But I totally fail to receive. I was expecting / hoping to see a "bind" or "recvfrom" in your code B) ... no luck. So for me the mystery is how you are able to receive from the mount. But your code is nice and clear and I can't find the answer.

I still have a few things to try, eventually will manage to have this working, I hope.

Thanks for your time!

jaime
6 years 4 months ago #21339

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

  • Posts: 63
  • Thank you received: 6

Replied by Eric Vickery on topic TCP / UDP connections


Glad to try and help. Unfortunately I am out of ideas.
6 years 3 months ago #21347

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

  • Posts: 8
  • Thank you received: 1

Replied by Jaime Alemany on topic TCP / UDP connections

Thanks.

I tried some ideas yesterday with no luck. I'll try again as soon as I can divert some time.

Once I've worked this out I'll report back.
6 years 3 months ago #21368

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

Time to create page: 1.902 seconds