示例#1
0
        public override void EndWrite(IAsyncResult asyncResult)
        {
            AsyncFileStream_AsyncResult afsar = CheckParameterForEnd(asyncResult, true);

            afsar.WaitCompleted();

            m_outstandingRequests.Remove(afsar);

            // Now check for any error during the write.
            if (afsar.m_errorCode != 0)
            {
                throw new IOException("Async Write failed", afsar.m_errorCode);
            }
        }
示例#2
0
        public override int EndRead(IAsyncResult asyncResult)
        {
            AsyncFileStream_AsyncResult afsar = CheckParameterForEnd(asyncResult, false);

            afsar.WaitCompleted();

            m_outstandingRequests.Remove(afsar);

            // Now check for any error during the read.
            if (afsar.m_errorCode != 0)
            {
                throw new IOException("Async Read failed", afsar.m_errorCode);
            }

            return(afsar.m_numBytes);
        }