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

PostSendCommandProcessing() private method

private PostSendCommandProcessing ( Stream &stream ) : bool
stream Stream
return bool
        private bool PostSendCommandProcessing(ref Stream stream)
        {
            if (_doRead)
            {
                // In async case, the next call can actually result in a
                // series of synchronous completions that eventually close
                // the connection. So we need to save the members that 
                // we need to access, since they may not be valid after the 
                // next call returns
                bool isAsync = _isAsync;
                int index = _index;
                PipelineEntry[] commands = _commands;

                try
                {
                    ResponseDescription response = ReceiveCommandResponse();
                    if (isAsync)
                    {
                        return true;
                    }
                    _currentResponseDescription = response;
                }
                catch
                {
                    // If we get an exception on the QUIT command (which is 
                    // always the last command), ignore the final exception
                    // and continue with the pipeline regardlss of sync/async
                    if (index < 0 || index >= commands.Length ||
                        commands[index].Command != "QUIT\r\n")
                        throw;
                }
            }
            return PostReadCommandProcessing(ref stream);
        }

Usage Example

Beispiel #1
0
        /// <summary>
        ///    <para>Provides a wrapper for the async write operations</para>
        /// </summary>
        private static void WriteCallback(IAsyncResult asyncResult)
        {
            CommandStream connection = (CommandStream)asyncResult.AsyncState;

            try {
                try {
                    connection.EndWrite(asyncResult);
                }
                catch (IOException) {
                    connection.MarkAsRecoverableFailure();
                    throw;
                }
                catch {
                    throw;
                }
                Stream stream = null;
                if (connection.PostSendCommandProcessing(ref stream))
                {
                    return;
                }
                connection.ContinueCommandPipeline();
            } catch (Exception e) {
                connection.Abort(e);
            }
        }
All Usage Examples Of System.Net.CommandStream::PostSendCommandProcessing