System.Net.FixedSizeReader.ReadPacket C# (CSharp) Method

ReadPacket() public method

public ReadPacket ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
return int
        public int ReadPacket(byte[] buffer, int offset, int count)
        {
            int tempCount = count;
            do
            {
                int bytes = _transport.Read(buffer, offset, tempCount);

                if (bytes == 0)
                {
                    if (tempCount != count)
                    {
                        throw new IOException(SR.net_io_eof);
                    }

                    return 0;
                }

                tempCount -= bytes;
                offset += bytes;
            } while (tempCount != 0);

            return count;
        }