1

I have a RaspberryPi connected to my home network via WiFi with a dynamic ip address. I then have my iPhone connected to the same network also via WiFi. The Pi has a lightweight c++ HTTP server running on it that can execute commands. I now want to write an Objective-C app that can find the Pi on the network, regardless of it's ip address, and send it commands. So, Universal Plug and Play seems like the logical solution - but everything I find on Google is dealing with Media players and streaming audio/video content.

I just want the Pi to somehow simply broadcast on my network - "Hey, I'm RasberryPi and my IP Address is 192.168.0.5!".

Can somebody please suggest a package or solution to this problem? Thanks!

3
  • It's a bit overkill for a home network, but I'm successfully using a dynamic dns service (dyn.com) to do essentially the same thing.
    – Quotidian
    Oct 23, 2013 at 18:58
  • my pi's register their hostname with my router when they receive their dhcp address. Since I also use my router as my in-house dns, I just refer to it by name, which gets resolved to the proper IP address. Perhaps your works similarly? Also, many systems nowadays broadcast on the 169.254.x.x subnet, called link-local, so NAME.local may work too as a machine hostname. I have my own domain which may be skewing the results here. Try host PI.local from a console or http://PI.local from a browser. (replace PI with proper name, of course)
    – lornix
    Oct 30, 2013 at 9:41
  • On the avahi thought, ONLY my laptop has an avahi daemon running, the router and pi's do not, although ALL will resolve properly with avahi-resolve-host-name web.lornix.com and so forth. Very weird. Neat. But weird. Probably related to my having own domain, dns, etc. Hmmm...
    – lornix
    Oct 30, 2013 at 9:43

4 Answers 4

0

your request to

simply broadcast on my network - "Hey, I'm RasberryPi and my IP Address is 192.168.0.5!".

Sounds like a job from not UPNP but UDP.

Set the PI up to periodically broadcast the IP message or the PI to listen for a "Whats your IP address" and then reply with the IP message via on UDP which can be sent to the whole network via the broadcast address.

Obviously programming is involved.

I set my PIs up with static IP address via the MAC address table in the DHCP settings of the router.

1

I would suggest to setup an avahi daemon on PI which is essentially bonjour. on the iPhone side it's fairly easy to implement as all Apple's hardware plays nicely with bonjour and api is very well documented.

0

You could install netatalk (Appletalk for 'NIX) on the Pi. This enables the Pi to be found using Bonjour.

Of course the easiest solution would be to get your DHCP server serve a fixed IP address to the Pi.

If this question is just about programming it would be better asked on Stack Overflow.

0

On the non-Pi side, you could instead use a program like "fing" from overlook soft to detect which IP address is being used by the raspberry Pi. Perhaps filter by mac address or description of connected device. Then provide that info to your app.

I use fing quite a bit with my android phone, macBookPro, and windows machines. I haven't played with integrating it with a separate application - it does take line commands, but that could get a little clunky. Depends on how production-safe you need it to be, versus home grown and works for your own needs...

You could also just configure your router to always provide a static IP to your rPi's known mac address...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.