public bool ReadRangeRequest(BacnetAddress adr, BacnetObjectId object_id, uint idxBegin, ref uint Quantity, out byte[] Range, byte invoke_id = 0)
{
Range = null;
using (BacnetAsyncResult result = (BacnetAsyncResult)BeginReadRangeRequest(adr, object_id, idxBegin, Quantity, true, invoke_id))
{
for (int r = 0; r < m_retries; r++)
{
if (result.WaitForDone(m_timeout))
{
Exception ex;
EndReadRangeRequest(result, out Range, out Quantity, out ex); // quantity read could be less than demanded
if (ex != null) throw ex;
else return true;
}
if (r < (m_retries - 1))
result.Resend();
}
}
return false;
}