Iam1337 / extOSC

extOSC is a tool dedicated to simplify creation of applications in Unity with OSC protocol usage.
MIT License
193 stars 25 forks source link

How should a receiver bind to a fixed ip address #7

Closed haoyuant closed 5 years ago

haoyuant commented 5 years ago

Hi, the pc running my project has two network interface, one of the two is the network the project required, but it seems OSC receiver just pick up one ip address arbitrarily, so sometimes the system does not work properly, I am wandering if there is a way to set the receiver always using a fixed ip address (e.g. 192.168.1.2) instead of changing every time? If no such public API in the package, how should I change the source code to get it work? Thanks.

Iam1337 commented 5 years ago

Hi, currently you can’t set the fixed IP in OSCReceiver. It planned in future updates.

But you can try to look in: Assets\extOSC\Scripts\Core\Network\OSCStandaloneManager.cs line 57.

public static IPEndPoint CreateLocalEndPoint(int localPort)
{
    if (localPort == 0)
        return null;

    return new IPEndPoint(IPAddress.Any, localPort);
}

Here I create a shared local IP for OSCTransmitter and OSCReceiver components.

haoyuant commented 5 years ago

That solves the problem, thanks! And it's good to hear that this library will be even better.