title: Boost::asio server/client socket, access permissions and ports issue
body: <p>A new error arose with my server (boost::asio based) once I implemented reconnection on my client but I am not even sure if this is the cause. The scenario is like this:</p>
  
  <ol>
  <li>I run Client.exe which can reconnect in case a server is not running. Client.exe creates several objects which connect independently to my server. So several connections to my servers are created from the same process.</li>
  <li>Because I haven't run the server yet, every object try to reconnect every 3 seconds (some of them concurrently so not always at the same time).</li>
  <li>The problem occurs <strong>sometimes</strong> when I start the server: I get the "An attempt was made to access a socket in a way forbidden by its access permissions" error.</li>
  </ol>
  
  <p>Looking with TCPView I found that everything looks good and it works. The server listen on the port 7000. But when this problem arises I can see a weird thing with TCPView:</p>
  
  <pre><code>Client.exe  9016    TCP ME  7000    localhost   7000    ESTABLISHED
  </code></pre>
  
  <p>How is this possible while the server is <strong>not</strong> running? same port? I checked and there is no other process listening on this port! How can exists and ESTABLISHED connection on the 7000 port if there is nothing on the other side listening. Then, of course, the port is in use by the client and I get this error (not really sure why I get this error and not something like "port already in use". </p>
  
  <p>Notes: I do not have antivirus, windows firewall is deactivated and not other process is using the port 7000. I only have a server which listen on port 7000 and a client connecting to the server. After several times stopping (cleanly) and starting the server this weird connection appears.</p>
  
  <p>EDIT: server and client are running on the same machine</p>