private void AuthenticationCallback(IAsyncResult asyncResult) { if (asyncResult == null) { return; } TcpHost host = asyncResult.AsyncState as TcpHost; if (host == null) { return; } try { host.EndAuthenticationAsServer(asyncResult); ReadFirstPacket(host); } catch (IOException) { // Somehow, the authentication failed... Close the connection host.Close(); } }