riot icon indicating copy to clipboard operation
riot copied to clipboard

Support for UDP / datagram sockets

Open leostera opened this issue 1 year ago • 2 comments

At the moment only TCP sockets are nicely supported, but I've had folks reach out with UDP use-cases so it'd be a good idea to at least have basic support for it.

Implementation Notes

So we'd need to extend the riot/runtime/net/addr.ml to make a distinction between unix / datagram / stream sockets with something like:

type datagram_addr = [ `Udp of ip_addr * int | `Unix of string ]
type stream_addr = [ `Tcp of ip_addr * int | `Unix of string ]

And then amend all the functions and interfaces, including riot/lib/net.ml which has a user-facing Addr module with functions like get_info.

Testing Ideas

I'm not very well versed in UDP tbh, so I'm very open to ideas on how to test the correctness and robustness of this. One thought would be to see if we can implement a low-level protocol like Wake-On-LAN as a test, if its not too much work.

leostera avatar Jan 01 '24 23:01 leostera

dibs!

wonbyte avatar Jan 05 '24 20:01 wonbyte

I feel like we can lean on this as it's only implemented in UDP: https://github.com/EmilHernvall/dnsguide as well as the real project: https://github.com/EmilHernvall/hermes

wonbyte avatar Jan 05 '24 22:01 wonbyte