public override int Read ([In,Out] byte[] buffer, int offset, int count)
{
CheckDisposed ();
if (buffer == null)
throw new ArgumentNullException ("buffer");
if (offset < 0 || count < 0)
throw new ArgumentOutOfRangeException ("offset or count less than zero.");
if (buffer.Length - offset < count )
throw new ArgumentException ("offset+count",
"The size of the buffer is less than offset + count.");
int error;
bool poll_result = poll_serial (fd, out error, read_timeout);
if (error == -1)
ThrowIOException ();
if (!poll_result) {
// see bug 79735 http://bugzilla.ximian.com/show_bug.cgi?id=79735
// should the next line read: return -1;
throw new TimeoutException();
}
return read_serial (fd, buffer, offset, count);
}