Osc.SetAddressHandler C# (CSharp) Method

SetAddressHandler() public method

Set the method to call back on when a message with the specified address is received. The method needs to have the OscMessageHandler signature - i.e. void amh( OscMessage oscM )
public SetAddressHandler ( string key, OscMessageHandler ah ) : void
key string Address string to be matched
ah OscMessageHandler The method to call back on.
return void
    public void SetAddressHandler(string key, OscMessageHandler ah)
    {
      Hashtable.Synchronized(AddressTable).Add(key, ah);
    }

Usage Example

Ejemplo n.º 1
0
    /// <summary>
    /// Start is called just before any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        words = codeword.Split(' ');
        UDPPacketIO udp = GetComponent <UDPPacketIO>();

        udp.init(remoteIp, sendToPort, listenerPort);

        oscHandler = GetComponent <Osc>();
        oscHandler.init(udp);

        oscHandler.SetAddressHandler("/remoteIP", setRemoteIP);
        oscHandler.SetAddressHandler("/text", textFromOSC);

        if (messageCanvas == null)
        {
            messageCanvas = transform.Find("OscMessageCanvas").gameObject;
            if (messageCanvas != null)
            {
                messageText = messageCanvas.transform.Find("MessageText").GetComponent <Text>();
            }
        }

        string localIP;

        using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0)) {
            socket.Connect("8.8.8.8", 65530);
            IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint;
            localIP = endPoint.Address.ToString();
        }
        setText("This IP is: " + localIP);
    }
All Usage Examples Of Osc::SetAddressHandler