title: running program a second time returns EADDRINUSE for bind
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/548879/releasing-bound-ports-on-process-exit">Releasing bound ports on process exit</a><br>
    <a href="https://stackoverflow.com/questions/4979425/difference-between-address-in-use-with-bind-in-windows-and-on-linux-errno-9">difference between &ldquo;address in use&rdquo; with bind() in Windows and on Linux - errno=98</a>  </p>
  </blockquote>
  
  
  
  <p>I have a simple server application I'm writing for Linux and it works decently the first time I run it, but for some reason it's not releasing the port on exit. It seems like I have to wait for some kind of timeout before I can rerun the application to get the port. Otherwise I get an EADDRINUSE error on the bind call. </p>
  
  <p>I feel like I must be doing something stupid, but I have been banging my head against the problem for a while and haven't figured it out, so if someone can point me in the right direction that'd be great. I've tried closing the bound and accepted sockets many times, and at different points, but no luck.</p>