0

I carry my phone and laptop with me everywhere, and I have many software solutions that communicate through Wi-Fi. (For example, I can play/stop/pause the music on my laptop using my cell phone).

I'd like a way for my laptop to automatically discover the new IP address of my phone upon joining a new network, like a coffee shop for instance. I could just assign a static IP to my phone, but I'd prefer to keep DHCP.

I'm thinking maybe a script that executes an arp-scan? My phone's MAC address is static, obviously. Then sets an environment variable?
I could run this script after I have seen that my phone is connected.
Just where my head is going. Thanks for your advice.

  • Something like DynDNS? Automatically updated domain name, so whenever you have new IP, domain name is updated so it always follows your IP. – rsm Aug 19 '14 at 16:50
  • I'd like this to stay within the LAN. When I say IP I mean 192.168.*.* which is assigned by a DHCP server. In my home LAN I have static leases for all my devices, but this isn't possible/feasible in a public network. – curios Aug 19 '14 at 20:20
  • And it wouldn't work, I forgot you will be assigned local IP. BUT! Maybe you can simply broadcast a custom UDP message from your mobile? en.wikipedia.org/wiki/Broadcast_address And maybe you can talk about it with this guy stackoverflow.com/questions/14080573/… "I'm developing an app that uses wifi to broadcast UDP messages between all the mobiles that are in the same network that have my app" – rsm Aug 19 '14 at 20:36
0

This is what IETF ZeroConf networking is for.

Android supports it (they call it Network Service Discovery or NSD), and iOS and OS X support the hell out of it, because it's what Apple calls Bonjour. Apple has a Bonjour for Windows that you can install on Windows, and Linux platforms have various options such as Avahi.

If you've got the dns-sd command-line tool installed your laptop, and you know your phone's name is "myPhone", then you can find its IP address like this:

dns-sd -G v4v6 myPhone.local
^C

(By default dns-sd stays open looking for other results until you Ctrl-C out of it.)

| improve this answer | |

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.