After spawning a server on a tokio Runtime, then shutting down the runtime (using shutdown_now), recreating a server on the same IP and port with a new Runtime panics, claiming
error creating server listener: Only one usage of each socket address (protocol/network address/port) is normally permitted. (os error 10048)
If I instead recreate the server by restarting the process, it works fine.
This behaviour is being observed on Windows 7. I have tried sleeping the thread for up to 10 seconds before recreating the server and the same error occurs.
Other than shutting down the Runtime, is there something else I must do to cleanly close a server? The documentation mentions the concept of "shutdown" in passing, but does not elaborate on what must be done to achieve that correctly.
After spawning a server on a tokio
Runtime, then shutting down the runtime (usingshutdown_now), recreating a server on the same IP and port with a newRuntimepanics, claimingIf I instead recreate the server by restarting the process, it works fine.
This behaviour is being observed on Windows 7. I have tried sleeping the thread for up to 10 seconds before recreating the server and the same error occurs.
Other than shutting down the
Runtime, is there something else I must do to cleanly close a server? The documentation mentions the concept of "shutdown" in passing, but does not elaborate on what must be done to achieve that correctly.