Getting *my* UDP Port

benniy's icon

hei folks,

have raised this question a while ago – here's another try as it's crucial for a current project.
i'm using a digital mixing console (behringer's X32) that can speak OSC. the console receives on port 10023 and it certainly works well sending it data. the problem: it "answers" to the senders port (which seems to be .. random to some extent).

so: is there any way to find the UDP port i am / max is sending from and [udpreceive] from this port? i'd be happy with any possible (also 3rd party / port rerouting) solution.

thanks

Jesse's icon

This is standard for UDP or TCP sockets - the local port used for transmission is selected at random unless it's specified at construction. I don't believe [udpreceive] allows this.

I'd highly recommend you look into using the NetUtil library via [mxj]. The OSCClient class appears to do exactly what you're looking for.

benniy's icon

hello jesse,

thanks a lot for your help! great – have been seeking a solution on and off for months.
unfortunately the mxj is totally new for me... is it a steep challenge to implement the netutil library?

Wetterberg's icon

strangely it seems like it's the first OSC device I've come across that behaves in this manner. Does anyone know the OSC specs well enough to know whether it's allowed under the OSC specs as well as the UDP specs?

Jesse's icon

Making a custom class for [mxj] would require you to extend the MaxObject Java class that Cycling provides as part of the "max.jar" archive that ships with Max. It's fairly trivial if you're familiar with Java development, but it may take some doing if not.

Cycling74 has included [mxj] in Max 7 but apparently will not develop it further, which is a shame. I recommend that you read the PDF that ships with Max titled "WritingMaxExternalsInJava.pdf" for an introduction.

On my Mac system this resides in the /Applications/Max.app/Contents/Resources/C74/java-doc folder. There's also a basic tutorial in a folder at that location.

I have developed many custom Java classes for Max using Eclipse, which is a free IDE for Java development. The trick is to point your project to the "max.jar" file so that you can import the com.cycling74.max package and work with the Max Java API. You would need to do something similar with the NetUtil library in order to make use of that in your custom class.

Good luck - there are several Java developers on the forum, including me, who can answer questions as they come up. Network programming is generally simple in Java, and you'll learn a lot in building this if you're up for it.

benniy's icon

hei jesse (& andreas),

thanks for your detailed help! really kind of you to take the time.
java is still absolute rocket science for me as a novice programmer..
anyhow i've found something over at maxobjects.com that could possibly simply my life.
http://maxobjects.com/?v=objects&id_objet=4654

still – i have no clue yet as for how to implement it. will take some learning, i guess :)
thanks!