Beispiel #1
0
        public OscServer(int port, int bufferSize = 4096)
        {
            if (PortToServer.ContainsKey(port))
            {
                Debug.LogError($"port {port} is already in use, cannot start a new OSC Server on it");
                return;
            }

            k_SingleCallbackToPair.Clear();
            AddressSpace = new OscAddressSpace();

            m_ReadBuffer   = new byte[bufferSize];
            m_BufferHandle = GCHandle.Alloc(m_ReadBuffer, GCHandleType.Pinned);
            m_BufferPtr    = (byte *)m_BufferHandle.AddrOfPinnedObject();
            Parser         = new OscParser(m_ReadBuffer);

            Port     = port;
            m_Socket = new OscSocket(port)
            {
                Server = this
            };
            Start();
        }