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;
}