BeginFlush() 개인적인 메소드

private BeginFlush ( AsyncCallback callback, object state ) : IAsyncResult
callback AsyncCallback
state object
리턴 IAsyncResult
예제 #1
0
        internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
        {
            MultiAsyncResult multiResult = new MultiAsyncResult(conn, callback, state);

            multiResult.Enter();
            IAsyncResult writeResult = conn.BeginFlush(s_onWrite, multiResult);

            if (writeResult.CompletedSynchronously)
            {
                conn.EndFlush(writeResult);
                multiResult.Leave();
            }
            SmtpReplyReader reader = conn.Reader.GetNextReplyReader();

            multiResult.Enter();

            //this actually does a read on the stream.
            IAsyncResult result = reader.BeginReadLine(s_onReadLine, multiResult);

            if (result.CompletedSynchronously)
            {
                LineInfo info = reader.EndReadLine(result);
                if (!(multiResult.Result is Exception))
                {
                    multiResult.Result = info;
                }
                multiResult.Leave();
            }
            multiResult.CompleteSequence();
            return(multiResult);
        }
예제 #2
0
        internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
        {
            MultiAsyncResult multiResult = new MultiAsyncResult(conn, callback, state);

            multiResult.Enter();
            IAsyncResult writeResult = conn.BeginFlush(s_onWrite, multiResult);

            if (writeResult.CompletedSynchronously)
            {
                conn.EndFlush(writeResult);
                multiResult.Leave();
            }
            SmtpReplyReader reader = conn.Reader.GetNextReplyReader();

            multiResult.Enter();
            IAsyncResult readLinesResult = reader.BeginReadLines(s_onReadLines, multiResult);

            if (readLinesResult.CompletedSynchronously)
            {
                LineInfo[] lines = conn.Reader.CurrentReader.EndReadLines(readLinesResult);
                if (!(multiResult.Result is Exception))
                {
                    multiResult.Result = lines;
                }
                multiResult.Leave();
            }
            multiResult.CompleteSequence();
            return(multiResult);
        }
예제 #3
0
        internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
        {
            MultiAsyncResult result = new MultiAsyncResult(conn, callback, state);

            result.Enter();
            IAsyncResult result2 = conn.BeginFlush(onWrite, result);

            if (result2.CompletedSynchronously)
            {
                conn.EndFlush(result2);
                result.Leave();
            }
            SmtpReplyReader nextReplyReader = conn.Reader.GetNextReplyReader();

            result.Enter();
            IAsyncResult result3 = nextReplyReader.BeginReadLine(onReadLine, result);

            if (result3.CompletedSynchronously)
            {
                LineInfo info = nextReplyReader.EndReadLine(result3);
                if (!(result.Result is Exception))
                {
                    result.Result = info;
                }
                result.Leave();
            }
            result.CompleteSequence();
            return(result);
        }
예제 #4
0
        internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
        {
            MultiAsyncResult multiResult = new MultiAsyncResult(conn, callback, state);
            multiResult.Enter();
            IAsyncResult writeResult = conn.BeginFlush(s_onWrite, multiResult);
            if (writeResult.CompletedSynchronously)
            {
                conn.EndFlush(writeResult);
                multiResult.Leave();
            }
            SmtpReplyReader reader = conn.Reader.GetNextReplyReader();
            multiResult.Enter();

            //this actually does a read on the stream.
            IAsyncResult result = reader.BeginReadLine(s_onReadLine, multiResult);
            if (result.CompletedSynchronously)
            {
                LineInfo info = reader.EndReadLine(result);
                if (!(multiResult.Result is Exception))
                    multiResult.Result = info;
                multiResult.Leave();
            }
            multiResult.CompleteSequence();
            return multiResult;
        }
 internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
 {
     MultiAsyncResult result = new MultiAsyncResult(conn, callback, state);
     result.Enter();
     IAsyncResult result2 = conn.BeginFlush(onWrite, result);
     if (result2.CompletedSynchronously)
     {
         conn.EndFlush(result2);
         result.Leave();
     }
     SmtpReplyReader nextReplyReader = conn.Reader.GetNextReplyReader();
     result.Enter();
     IAsyncResult result3 = nextReplyReader.BeginReadLines(onReadLines, result);
     if (result3.CompletedSynchronously)
     {
         LineInfo[] infoArray = conn.Reader.CurrentReader.EndReadLines(result3);
         if (!(result.Result is Exception))
         {
             result.Result = infoArray;
         }
         result.Leave();
     }
     result.CompleteSequence();
     return result;
 }
예제 #6
0
 internal static IAsyncResult BeginSend(SmtpConnection conn, AsyncCallback callback, object state)
 {
     MultiAsyncResult multiResult = new MultiAsyncResult(conn, callback, state);
     multiResult.Enter();
     IAsyncResult writeResult = conn.BeginFlush(s_onWrite, multiResult);
     if (writeResult.CompletedSynchronously)
     {
         conn.EndFlush(writeResult);
         multiResult.Leave();
     }
     SmtpReplyReader reader = conn.Reader.GetNextReplyReader();
     multiResult.Enter();
     IAsyncResult readLinesResult = reader.BeginReadLines(s_onReadLines, multiResult);
     if (readLinesResult.CompletedSynchronously)
     {
         LineInfo[] lines = conn.Reader.CurrentReader.EndReadLines(readLinesResult);
         if (!(multiResult.Result is Exception))
             multiResult.Result = lines;
         multiResult.Leave();
     }
     multiResult.CompleteSequence();
     return multiResult;
 }