Dota2GSI.GameStateListener.ReceiveGameState C# (CSharp) Method

ReceiveGameState() private method

private ReceiveGameState ( IAsyncResult result ) : void
result IAsyncResult
return void
        private void ReceiveGameState(IAsyncResult result)
        {
            try
            {
                HttpListenerContext context = net_Listener.EndGetContext(result);
                HttpListenerRequest request = context.Request;
                string JSON;

                waitForConnection.Set();

                using (Stream inputStream = request.InputStream)
                {
                    using (StreamReader sr = new StreamReader(inputStream))
                        JSON = sr.ReadToEnd();
                }
                using (HttpListenerResponse response = context.Response)
                {
                    response.StatusCode = (int)HttpStatusCode.OK;
                    response.StatusDescription = "OK";
                    response.Close();
                }
                CurrentGameState = new GameState(JSON);
            }
            catch (ObjectDisposedException)
            {
                // Intentionally left blank, when the Listener is closed.
            }
        }