hoijui / JavaOSC

OSC content format/"protocol" library for JVM languages

Home Page:http://www.illposed.com/software/javaosc.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sending and receiving on same port

RussellAult opened this issue · comments

I'm writing a program to work with the Behringer X32, which has the peculiar requirement that any programs it works with be able to send and receive OSC messages on the same port. The only way I've been able to do this is to add an additional constructor to the OSCPortIn and OSCPortOut classes that requires (among other things) a DatagramSocket. By creating the socket in advance and passing it to the In and Out ports, both can share the same socket (and therefore the same port):

For OSCPortIn:
/**
* Create an OSCPort that listens using a specified socket.
* @param socket DatagramSocket to listen on.
* @throws SocketException
*/
public OSCPortIn(DatagramSocket socket) throws SocketException {
super(socket, socket.getLocalPort());
}

For OSCPortOut:
/**
* Create an OSCPort that sends to address:port using a specified socket.
* @param address the UDP address to send to
* @param port the UDP port to send to
* @param socket the DatagramSocket to send from
*/
public OSCPortOut(InetAddress address, int port, DatagramSocket socket)
throws SocketException
{
super(socket, port);
this.address = address;
}

Is this something worth adding to the project?

sure! I agree!

thanks!
i figured it does not add lots of bloat, and thus should not hurt too much.
added in:
0da978b

Hey @RussellAult,

i am currently working on a Behringer X32 Control Software as well. It's job will be to switch the Scenes on multiple X32 Consoles at the "same" time. I already did a working Prototype with Python (python-osc) but now I want to translate my software to java, to be also able to use the softwares functionality from my Android Phone. I am really struggleing with rewriting it in java tho. When I researched correctly, the only way to send and recieve OSC Data is JavaOSC. Could you give me some basic tipps or a view into your code, for me to be able to figure it out for myself more easily. Btw. the software will be for a School-Concert so its no commercial project.

Thanks already for the help!
Greetings Lukas