Connect an application to a Rug.osc client

488 views Asked by At

I have an application Kinectv2osc that uses rug.osc to send UPD packets in my local machine. But it seems it binds the port, and I cannot connect puredata (OSCdump) to listen to these osc messages.

If I launch the applications in reverse order, puredata can connect, but Kinectv2Osc can't.

I guess both applications try to bind the port, so what application is to blame? Is there any workaround to make these two applications work together?

1

There are 1 answers

0
Phill Tew On

A little more detail would be useful, however this may help.

You are maybe getting a clash on your local and remote ports, by default Rug.Osc uses the same port for local and remote. If the other end is doing the same this may be a problem. It is possible to allow applications / sockets to play nicely and share ports and Rug.Osc makes attempts to do this however others may not feel the same way.

To fix this you can override the local port that Rug.Osc will bind too. If you use a 0 then the OS will select a port that is not in use.

IPAddress address = IPAddress.Parse("127.0.0.1"); 
int remotePort = 12345;

// force the OS to select an unused port
int localPort = 0; 

using (OscSender sender = new OscSender(address, localPort, remotePort)) 
{
    sender.Connect();

    sender.Send(new OscMessage("/test", 1, 2, 3, 4));
}

Disclaimer: Rug.Osc is my project.