title: C# Socket doesn't disconnect properly
body: <p>I'm working on a server for the game <em>Minecraft</em>, which shows a dark-red screen when the player is disconnected. I'm disconnecting players like this:</p>
  
  <pre><code>Socket.Shutdown( SocketShutdown.Both );
  Socket.Close();
  </code></pre>
  
  <p>I seem to be unable to write data after that, but the disconnected screen doesn't appear. It only appears when I completely terminate the server application, which indicates that the connection isn't closed at all.</p>
  
  <p>What am I doing wrong?</p>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>socket.BeginAccept( new AsyncCallback( AcceptClient ), null );
  
  private void AcceptClient( IAsyncResult result )
      {
          try
          {
              // Initialize player
              Socket client = _socket.EndAccept( result );
  </code></pre>
  
  <p>.</p>
  
  <pre><code>Log( "Received unrecognized packet from " + player.IPAddress() + ", disconnecting client!" );
  
  player.Disconnect();
  _clients.Remove( player );
  </code></pre>