0
I'm writing a network application, and have been running into a slight nuisance. I have to wait a period in-between tests, because my server program, even after closing still has the port I'm using "allocated" to it. Furthermore, this makes debugging really hard, since I can't tell what's causing whatever problem I'm dealing with.
For testing purposes, is there a way to free up TCP and UDP ports?
Thank you for the link, but this isn't quite what I'm asking for. Maybe I wasn't clear, but I need this for debugging. If the program crashes before the shutdown or close functions can be called, then I still have this problem. – Charles Noon – 2016-08-10T02:33:58.197
The answer is there but let me clarify it for you. If your program exits in an ungraceful manner. IE, it crashes, it gets forced killed, or it never calles the appropriate functions before closing. You will be forced to wait for the OS to do its clean up of stale sockets. Which is about a minute or so. Here is another link that details it more in depth about the problem you are having and why it exists and why you can't just deallocate a socket yourself outside the owning program that created the socket and the OS does it. http://superuser.com/a/127865/627762
– Frostalf – 2016-08-10T02:51:13.703