Reply port of asychronous commands

Hey there! I am trying to get and read the messages which are sent from the server via OSC.

As far as I understand it right, senders and receivers of messages can not sit on the same port. But when booting the server, I can only specify one port. Can anybody please help me out here and tell me which port number to listen to or how to specify this? Thank you!

This is possible to check by yourself:

s.boot;

s.addr;
-> a NetAddr(127.0.0.1, 57110)

OSCFunc.trace(true, true);

b = Buffer.alloc(s, 1000, 1);

OSC Message Received:
	time: 22.711424577
	address: a NetAddr(127.0.0.1, 57110)
	recvPort: 57120
	msg: [ /done, /b_alloc, 0 ]

OSCFunc.trace(false);

“address: a NetAddr(127.0.0.1, 57110)” is the IP and port from which scsynth is sending the message – same as s.addr. So the assumption isn’t correct that scsynth’s receiving and sending port numbers must be different – they are actually the same.

This means you can just use s.addr as the srcID in OSCFunc / OSCdef.

(The absolute worst case, by the way, with OSCFunc / OSCdef is, if all else fails, you can completely omit the IP/port filter and respond to OSC from everywhere. Or you can filter on IP address but leave out the port: srcID: NetAddr("127.0.0.1") will match messages coming from localhost, from any port, but not other addresses.)

hjh

1 Like