Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect presence of a device in a WiFi network?

I'm working on a project based on Intel Edison(Running Debian based Ubilinux).I need Edison to execute some code whenever,my android phone(running CM11) connects to the same WiFi as the Edison.How can I detect the presence of my phone in Edison? I have tried the following.

1.Pinging: But the problem is that router assigns different IP's every time because of DHCP.So,I will not be knowing the IP address of my phone. Is there any way to ping based on device's MAC address?

2. I thought of broadcasting a special discovery packet from my phone,whenever it gets connected to the WiFi.But,I don't know where to start with this approach.

like image 607
Heisenberg Avatar asked Sep 28 '22 10:09

Heisenberg


1 Answers

Finding the mac-address would probably work. Basically you can run the arp command to see what mac-address matches which IP. There's a question on doing that here:

Obtain MAC Address from Devices using Python

like image 130
John Montgomery Avatar answered Oct 05 '22 08:10

John Montgomery