[Help] Connecting Max with Arduino Ethernet Shield w/out knowing IP Address
Main Question:
Is there a way in Max to get a list of the ip addresses on the network currently being used by devices so that I can send udp packets to every device on the network? This way when the arduino receives a specific message it will reply with its ip address
What I Want To Accomplish:
I would like to be able to plug the arduino board (connected via the ethernet shield) to any network, and then be able to connect to it through the max patch on the same network without strictly knowing its ip. I've looked a little bit into multicasting and net.maxhole but I haven't found a concrete answer. I've also have tried to figure it out on the arduino side of things, but still have yet to find a concrete method.
What I Have So Far:
Right now I am able to send OSC messages to the arduino board to control different pins. The problem is on my home network I have the ip address reserved for the arduino based on its mac address, but I am developing something where it needs to be able to get any ip address and max will be able to find it on the network.
Just looking for a someone to point me in the right direction. Any help is greatly appreciated.
KP
I see two ways to accomplish this.
1. From Max you can launch nmap utility to scan some range of IP addresses and parse its output with [regex]. On OS X exists [shell] object that allows to execute bash scripts from Max. Depending on the size of the IP scanning range this operation can take a lot of time.
2. You can try to program Arduino to periodically send discovery UDP packets over broadcast address. If you do so, all clients in local network will receive this packet. After catching it in Max you'll be able to retrieve Arduino's IP address. I'm not sure that you can retrieve sender's IP with [udpreceive], but you certainly can do it with a little of Java programming: http://docs.oracle.com/javase/tutorial/networking/datagrams/
OSCII,
Thanks so much for the info. I think that will definitely help me.
I'll try to work it out this week and post my progress.
KP