public Read ( byte buffer, int offset, int length, int timeout_ms ) : int | ||
buffer | byte | |
offset | int | |
length | int | |
timeout_ms | int | |
return | int |
public int Read(byte[] buffer, int offset, int length, int timeout_ms)
{
if (m_port == null) return 0;
m_port.ReadTimeout = timeout_ms;
try
{
int rx = m_port.Read(buffer, offset, length);
return rx;
}
catch (TimeoutException)
{
return -BacnetMstpProtocolTransport.ETIMEDOUT;
}
catch (Exception)
{
return -1;
}
}