示例#1
0
        IAsyncResult PrepareSyncReadResult(int readBytes, object state)
        {
            SSLSyncResult <int> result = new SSLSyncResult <int>();

            result.Result     = readBytes;
            result.AsyncState = state;
            return(result);
        }
示例#2
0
 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 {
     _curwritePacket = null;
     Write(buffer, offset, count);
     if ((_state & SSLHandlerState.Authenticating) != 0 && _needRead)
     {
         //如果是在握手阶段则使用异步,需要读取才结束
         _AsyncWrite            = new SSLAsyncResult <int>();
         _AsyncWrite.Callback   = callback;
         _AsyncWrite.AsyncState = state;
         return(_AsyncWrite);
     }
     else
     {
         SSLSyncResult <int> result = new SSLSyncResult <int>();
         result.AsyncState = state;
         return(result);
     }
 }