Beispiel #1
0
        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)
            {
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 private void OnPacketProcessed(ClientPacket packet)
 {
     PacketProcessed?.Invoke(this, new PacketProcessedEventArgs(packet));
 }