Reply port of asychronous commands

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