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.
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)
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.
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 ... 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.