private void ListenLoop() { try { while (OscReceiver.State != OscSocketState.Closed) { // if we are in a state to receive if (OscReceiver.State != OscSocketState.Connected) { continue; } // get the next message // this will block until one arrives or the socket is closed OscPacket packet = OscReceiver.Receive(); PacketReceived?.Invoke(packet); if (packet.Error == OscPacketError.None) { OscAddressManager.Invoke(packet); } PacketProcessed?.Invoke(packet); } } catch (Exception ex) { } }
public bool TryReceive() { // if we are in a state to receive if (OscReceiver?.State != OscSocketState.Connected) { return(false); } // try and get the next message bool packetReceived = OscReceiver.TryReceive(out OscPacket packet); if (packetReceived == false) { return(false); } PacketReceived?.Invoke(packet); if (packet?.Error == OscPacketError.None) { OscAddressManager.Invoke(packet); } PacketProcessed?.Invoke(packet); return(true); }
private void OnPacketProcessed(ClientPacket packet) { PacketProcessed?.Invoke(this, new PacketProcessedEventArgs(packet)); }