Detect the cell phone connected to wireless networ

2019-07-09 02:55发布

I'm programming in C# and i want to detect a cell phone(Name, IP address, RSSI, ...) in Wireless Network (Wi-Fi) to calculate after that the distance between my computer and the cell phone Actually, I'm able to detect computers name connected to the same network with :

using System.DirectoryServices;
...

List<String> _ComputerNames = new List<String>();
String _ComputerSchema = "Computer";
DirectoryEntry _WinNTDirectoryEntries = new DirectoryEntry("WinNT:");
foreach (DirectoryEntry _AvailDomains in _WinNTDirectoryEntries.Children)
{
    foreach (DirectoryEntry _PCNameEntry in _AvailDomains.Children)
    {
        if (_PCNameEntry.SchemaClassName.ToLower().Contains(_ComputerSchema.ToLower()))
        {
            _ComputerNames.Add(_PCNameEntry.Name);
        }
    }
}

But I cannot find my cell phone that is connect to the same wi-fi network.

How can I resolve this problem ? Thanks!

2条回答
走好不送
2楼-- · 2019-07-09 03:25

I dont think ActiveDirectory is going to work too well for you here, your likely going to need to work more closely with the access point itself to fetch the RSSI values. Unless there is a particular domain knowledge you have about all phones being part of an ActiveDirectory its like Jean said: you only get MAC address, possibly IP address and the RSSI value.

If you are only interested in distance you will likely need to test out a range of distances with a particular device and use the RSSI-distance list you to guestimate the distance of a new device based on the RSSI value for it.

A problem you will encounter is you might have X RSSI Value for one device, and 2X RSSI Value for another device and they could very well be the exact same distance. Although if you are only interested in phones I would expect the fluctuation to be less severe.

A more accurate way to do this would be to have multiple Access Points setup and triangulate the device's position with a bit of math, the plus side of this is also giving you distance as well as direction, amounting to location

查看更多
Anthone
3楼-- · 2019-07-09 03:30

Unless I am mistaken, only the Wi-Fi access point itself will have access to the full list of devices. Even then, it doesn't know what type each device is. It knows the MAC address of each device, and it may know the IP it was allocated (assuming it is also a DHCP server), but beyond that the device could be anything from a laptop to a television.

If you are a network administrator, then I can see how this might be useful - if you have a policy where only certain devices are intended to connect to the network, then it makes sense to hunt down "rogue" devices. Otherwise, I can't see any good reason to try and help you any further.

查看更多
登录 后发表回答