OSCReceiver expose getBoundPort()


#1

Hello,

I'd like to let the system assign the OSCReceiver port by calling connect(0). The existing code already allows this, I think, but I need getBoundPort() to be exposed so I can find out what port got assigned. Thanks!


#2

Hi,

No, I don't think that's right. If you want to use an OSCReceiver, you always need to specify which port you want to listen to. This can't be 0, what would you expect it to do? If you listen to a randomly assigned UDP port for OSC messages, how can a sender ever send messages to it, and how are they supposed to arrive?


#3

Hello Timur, thank you for your reply.

As long as I have getBoundPort() I can send the assigned port number to the sender (who has a known port number).

By setting connect(0), all I'm expecting is the same behavior that the underlying DatagramSocket gives when calling bindToPort(0).

If it were possible to pass in my own DatagramSocket (or TCP socket or whatever) to OSCReceiver, I think this would be a valid thing to do unless there's something in the OSC protocol that I've missed.

 


#4

This is technically possible but it's not how OSC is normally used.

If you look at OSC apps out there, they all require you to use a specific port for OSC (9001 seems to be the most common default choice) and then you just connect to that.