/// <summary> /// Read Thread. Loops waiting for packets. When a packet is received, it is /// dispatched to any waiting All Message Handler. Also, the address is looked up and /// any matching handler is called. /// </summary> private void Read() { try { while (ReaderRunning) { int length = OscPacketIO.ReceivePacket(buffer); if (length > 0) { lock (ReadThreadLock) { if (paused == false) { ArrayList newMessages = OSC.PacketToOscMessages(buffer, length); messagesReceived.AddRange(newMessages); } } } else { Thread.Sleep(5); } } } catch (Exception e) { Debug.Log("ThreadAbortException" + e); } finally { } }
/// <summary> /// Read Thread. Loops waiting for packets. When a packet is received, it is /// dispatched to any waiting All Message Handler. Also, the address is looked up and /// any matching handler is called. /// </summary> private void Read() { int length = OscPacketIO.ReceiveIfAvailable(buffer); if (length > 0) { ArrayList newMessages = OSC.PacketToOscMessages(buffer, length); messagesReceived.AddRange(newMessages); } }