mirage/mirage-tcpip

unlisten of a port

hannesm opened this issue · 0 comments

A listen (_tcp / _udp) function exists, but there's no way to not listen to that port anymore. Now, in some use cases (e.g. a DNS resolver), all that is needed is "send packet from port P to Y:P'" and "wait for an answer to port P (from Y:P')", but once the answer is received, the listening socket on port P can be safely closed.

Also note that the current semantics of calliing listen mutliple times with the same port on the same stack diverges between socket and direct stack -- the socket stack will fail (ADDRINUSE), the direct stack will overwrite the listener.