System.Net.CommandStream.ReadCallback C# (CSharp) Method

ReadCallback() private static method

private static ReadCallback ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult
return void
        private static void ReadCallback(IAsyncResult asyncResult)
        {
            ReceiveState state = (ReceiveState)asyncResult.AsyncState;
            try
            {
                Stream stream = (Stream)state.Connection;
                int bytesRead = 0;
                try
                {
                    bytesRead = stream.EndRead(asyncResult);
                    if (bytesRead == 0)
                        state.Connection.CloseSocket();
                }
                catch (IOException)
                {
                    state.Connection.MarkAsRecoverableFailure();
                    throw;
                }
                catch
                {
                    throw;
                }

                state.Connection.ReceiveCommandResponseCallback(state, bytesRead);
            }
            catch (Exception e)
            {
                state.Connection.Abort(e);
            }
        }