static void ListenLoop()
        {
            try
            {
                while (receiver.State != OscSocketState.Closed)
                {
                    // if we are in a state to recieve
                    if (receiver.State == OscSocketState.Connected)
                    {
                        // get the next message
                        // this will block until one arrives or the socket is closed
                        OscPacket packet = receiver.Receive();

                        // Write the packet to the console
                        Console.WriteLine(packet.ToString());


                        // DO SOMETHING HERE!
                    }
                }
            }
            catch (Exception ex)
            {
                // if the socket was connected when this happens
                // then tell the user
                if (receiver.State == OscSocketState.Connected)
                {
                    Console.WriteLine("Exception in listen loop");
                    Console.WriteLine(ex.Message);
                }
            }
        }
Пример #2
0
        private void ListenLoop()
        {
            try
            {
                while (m_Receiver.State != OscSocketState.Closed)
                {
                    // if we are in a state to recieve
                    if (m_Receiver.State == OscSocketState.Connected)
                    {
                        // get the next message
                        // this will block until one arrives or the socket is closed
                        OscPacket packet = m_Receiver.Receive();

                        switch (m_Listener.ShouldInvoke(packet))
                        {
                        case OscPacketInvokeAction.Invoke:
                            m_Listener.Invoke(packet);
                            break;

                        case OscPacketInvokeAction.DontInvoke:
                            break;

                        case OscPacketInvokeAction.HasError:
                            break;

                        case OscPacketInvokeAction.Pospone:
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }