System.IO.BACnet.BacnetPtpProtocolTransport.WaitForGreeting C# (CSharp) Method

WaitForGreeting() private method

private WaitForGreeting ( int timeout ) : bool
timeout int
return bool
        private bool WaitForGreeting(int timeout)
        {
            if (m_port == null) return false;
            byte[] buffer = new byte[7];
            int offset = 0;
            int current_timeout;
            while (offset < 7)
            {
                if (offset == 0) current_timeout = timeout;
                else current_timeout = T_FRAME_ABORT;
                int rx = m_port.Read(buffer, offset, 7 - offset, current_timeout);
                if (rx <= 0) return false;
                offset += rx;

                //remove garbage
                RemoveGreetingGarbage(buffer, ref offset);
            }
            return true;
        }