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

Francesco Ceruti ceppofrancy at gmail.com
Wed Jul 6 10:37:28 UTC 2016


Il 06/07/2016 01:38, Kevin Cole ha scritto:
> Hi,
>
> 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"?
>
> If I explicitly supply the return IP in the server's
> udp_client.UDPClient(...) call it works.  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.
>
> I have no network-fu.
>
> Thanx!
> --
> @ubuntourist
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev at lists.linuxaudio.org
> http://lists.linuxaudio.org/listinfo/linux-audio-dev

Hi,

Looking at python-os "osc-server.py" code, I've noticed that the client 
address (IP, Port) is left, when dispatching UDP request,
you can either use a custom version (like this 
<http://pastebin.com/g7WBmHya>), were the callbacks receive the request 
address (in the example, as second argument),
or if you can freely decide what to send to the server, the clients can 
send their address into the requests, like this:

msg = osc_message_builder.OscMessageBuilder(address="/MyAddress")
msg.add_arg("Value")
msg.add_arg("IP_ADDRESS")  # replace with the client address using for 
example " socket.gethostname()"
msg = msg.build()
client.send(msg)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20160706/a63333aa/attachment.html>


More information about the Linux-audio-dev mailing list