I’m working with the tokio UDP library and have encountered this question. How does a UdpSocket recover from an error?
Consider recv_dgram. It takes the owned UdpSocket as input, and returns a RecvDgram future, which provides the UdpSocket back as part of the item type. But the error type in this case is only an error and the UdpSocket is inaccessible.
If my UdpSocket call fails, is my socket just gone and I need to reopen a new one if I want? Is UDP so sturdy that it just never fails and I don’t have to worry about it? I’m working on how to pass the socket’s ownership around right now and this case seemed confusing.
Any guidance is appreciated, thanks!