コード例 #1
0
        int ReadInternal(byte [] buffer, int offset, int size)
        {
            int nbytes = 0;

            request.CheckIfAborted();

            try
            {
                // Probably it would be better to have the socket here
                nbytes = networkStream.Read(buffer, offset, size);
            }
            catch (IOException)
            {
                throw new ProtocolViolationException("Server commited a protocol violation");
            }

            totalRead += nbytes;
            if (nbytes == 0)
            {
                networkStream = null;
                request.CloseDataConnection();
                request.SetTransferCompleted();
            }

            return(nbytes);
        }
コード例 #2
0
        private int ReadInternal(byte[] buffer, int offset, int size)
        {
            int num = 0;

            request.CheckIfAborted();
            try
            {
                num = networkStream.Read(buffer, offset, size);
            }
            catch (IOException)
            {
                throw new ProtocolViolationException("Server commited a protocol violation");
                IL_002d :;
            }
            totalRead += num;
            if (num == 0)
            {
                networkStream = null;
                request.CloseDataConnection();
                request.SetTransferCompleted();
            }
            return(num);
        }