[LAD] python-osc udp_client.UDPClient() - How do I figure out the reply-to IP?

Christopher Arndt chris at chrisarndt.de
Wed Jul 6 06:59:01 UTC 2016


Am 06.07.2016 um 01:38 schrieb Kevin Cole:
> In pythonosc (https://pypi.python.org/pypi/python-osc) after
> connecting with udp_client.UDPClient(...) from a "client", how can I
> detect the IP to respond to in the "server"?

Normally, with UDP servers, you'd use socket.recvfrom() to read the data 
from the client and get its address.

https://docs.python.org/3/library/socket.html#socket.socket.recvfrom

But it doesn't seem like pythonosc supplies the client's address to the 
dispatcher.

>But I want the server to
> listen for an incoming connection or call on a particular port and
> figure out who sent it and reply to that IP.

It's not uncommon for OSC software, that you have to specify client (a) 
address(es) in the server as well, since OSC, commonly using UDP as a 
transport, is only uni-directional, so to get bi-directional 
communication, every participant in an OSC communication has to be a 
server and a client.

If you don't need a pure-Python library, I'd look at python-liblo.


Chris



More information about the Linux-audio-dev mailing list