python-osc icon indicating copy to clipboard operation
python-osc copied to clipboard

Make it convenient to get return values from OSC server.

Open crocket opened this issue 6 years ago • 2 comments

https://github.com/njh/jackminimix returns values to OSC server calls.

Thus, I have to write

>>> import pythonosc.udp_client as uc
>>> client=uc.SimpleUDPClient("localhost", 14629)
>>> client.send(uc.OscMessageBuilder("/mixer/get_channel_count").build())
>>> res=uc.OscMessage(client._sock.recv(4096))
>>> res.address
'/mixer/channel_count'
>>> res.params
[1]

Getting return values should be more straightforward than using a hidden instance variable such as _sock.

crocket avatar Aug 16 '19 06:08 crocket

I agree, I am working on building a pure client for receiving OSC information (like play/pause information in a DAW), but of course this is done by connecting to the client, hence needing to just passively receive. Would be nice being able to do this in such a fashion as the server implementation

TheOnlyJoey avatar Oct 12 '19 20:10 TheOnlyJoey

The provided servers work with a dispatcher. You have to map callback functions to addresses you want to receive at. See the example.

Tip: You can also map the method of an object!

DrLuke avatar Nov 18 '22 10:11 DrLuke