示例#1
0
        void ServerLoop()
        {
            var parser = new OscPacketParser(_dispatcher);
            var buffer = new byte[4096];

            while (!_disposed)
            {
                try
                {
                    int dataRead = _socket.Receive(buffer);
                    if (!_disposed && dataRead > 0)
                        parser.Parse(buffer, dataRead);
                }
                catch (SocketException)
                {
                    // It might exited by timeout. Nothing to do.
                }
                catch (ThreadAbortException)
                {
                    // Abort silently.
                }
                catch (Exception e)
                {
                #if UNITY_EDITOR || UNITY_STANDALONE
                    if (!_disposed) UnityEngine.Debug.Log(e);
                #else
                    if (!_disposed) System.Console.WriteLine(e);
                #endif
                    break;
                }
            }
        }
示例#2
0
        void ServerLoop()
        {
            var parser = new OscPacketParser(_dispatcher);
            var buffer = new byte[32768];  // zk WAS 4096.  Increased the size had to avoid buffer overrunn with longer OSC JSON strings.

            while (!_disposed)
            {
                socketSetup();

                try
                {
                    int dataRead = _socket.Receive(buffer);
                    if (!_disposed && dataRead > 0)
                    {
                        parser.Parse(buffer, dataRead);
                    }
                }
                catch (SocketException)
                {
                    // It might exited by timeout. Nothing to do.
                }
                catch (ThreadAbortException)
                {
                    // Abort silently.
                }
                catch (Exception e)
                {
                #if UNITY_EDITOR || UNITY_STANDALONE
                    if (!_disposed)
                    {
                        UnityEngine.Debug.Log(e);
                    }
                #else
                    if (!_disposed)
                    {
                        System.Console.WriteLine(e);
                    }
                #endif
                    break;
                }
            }
        }