UdpClient/UdpServer may be confusing to users · Issue #31 · rust-embedded-community/embedded-nal (original) (raw)

Looking at the whole UdpClient/UdpServer thing from #21 I think the idea behind the trait it kind of changed.

Before it was called UdpStack and represented the whole network interface that creates sockets on demand for new connections, but now the same suddenly a UdpServer that creates either UdpSockets in server or client mode depending on the function you call. I think it is kind of confusing that your network interface has to implement UdpServer now.
I have no definitive answer how to make the API clearer, but maybe the socket types should be different in client and server mode instead of the stack. The stack traits could be called UdpStack/UdpServerStack or something like UdpSimpleStack/UdpAdvancedStack or UdpStackCore/... Maybe somebody has a good idea for names.

The point I am trying to make is, that it may be confusing to mix semantics of network interfaces and their traits and actual sockets. Similar things apply to TCP (#30) of course.