title: Socket remains open after program has closed (C++)
body: <p>I'm currently writing a small server application, and my problem is, that when I close my app (or better, press the terminate button in eclipse), the socket sometimes stays open, so when I execute my app the next time, bind() will fail with "Address already in use". How can I properly close my sockets when the program exits? I already put</p>
  
  <pre><code>close(mySocket);
  </code></pre>
  
  <p>in the class destructors, but that doesn't seem to change anything.  </p>