get sender IP address from udp packet received
hello,
I try to get the IP address on a local network of the device sending UDP packets to max msp. it is setup in DHCP, and i don't want to switch to a fixed IP each time I want to send a feedback to TouchOSC, e.g.
I searched on this forum but haven't found any way to do this yet, although I tried with these objects :
[udpreceive] (i set the full-packet mode, but don't get the point with the result)
[mxj net.udp.recv]
[sadam.udpReceiver]
non of these seem to provide sender IP address.
i guess it might be specified in the udp packet header or something because i found C# scripts that are able to retrieve this info...
any idea ?
Hi,
you're right, none of these do tell you the sender's IP address and port. At the time when I wrote the networking object of The sadam Library, I was not aware that this information is also available inside the incoming package (they were one of my very first Max-projects back in 2008 or so) and I was lazy to add this functionality to the objects ever since. But as there are more and more people asking for it, it might happen that I'd add this info in the next release.
Until then, you'll need to do some trick like the one described at the end of this thread:
Hope this helps,
Ádám
thanks Adam, I had found this thread but haven't read it to the end
"There are two things that you could do: either tell the second sensor to use another port and then read two ports, or force the sensors somehow to send also some sensor-ID thing which would let you split the incoming information within Max."
this solutions won't work in my case.
a solution might be to use zeroconf in android (the other name of bonjour) so udpsend could use my tablet hostname.local instead of its IP.
for now i can use "Samba Fileshare" to setup a NetBios name and access my android using this name from windows, but i was not able to resolve the hostname from mac os yet... but this is not a max msp story
thank you for your great work anyway, of course it would be great to see this feature in an upcoming release :]
Hi,
I just made an update to my library. Now [sadam.udpReceiver]
will give you the sender's IP address and port number on success. For details, see https://cycling74.com/forums/announce-the-sadam-library-version-2012-10-08 .
HTH,
Ádám
wahoo i couldn't hope such a quick and perfect response !
thank you adam (i will donate a bit - im not that rich - as soon as my credit card works again)
here is my patch to send ip to udpsend only when it changes :