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

From: Francesco Ceruti <ceppofrancy@email-addr-hidden>
Date: Wed Jul 06 2016 - 13:37:28 EEST

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@email-addr-hidden
> 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)

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Wed Jul 6 16:15:01 2016

This archive was generated by hypermail 2.1.8 : Wed Jul 06 2016 - 16:15:01 EEST