I am developing an application which should connect to an open WiFi access point and exchange messages with devices that are also connected to this access point. Lets assume the access point is open and has no restrictions. Would it be possible to request a list of the IP addresses of the devices which are connected to it? Then if we have the address would it be possible to initiate a connection and exchange messages with that device? Have you seen any similiar projects/apps? (Is it possible to do with regular access points without hacking?)
Thanks, any snippets/thoughts will be highly appreciated! :)
If you have your application running on all clients your interested in you could try to using a simple UDP broadcast. In every application on each client you'd just listen for a certian UDP packet on a specific port and once you receive it respond to the sender so that it will know that there's an app listening there. After that it should be easy to establish regular TCP connection. This method works only for LANs since UDP broadcasts are usually not routed. It is commonly used by games to search for active servers in local area networks.
There is no defined protocol for querying an AP for devices; you might want to go through one of the well-known discovery mechanisms (ZeroConf/Bonjour/Avahi, UPnP, DPWS, ...).
Here's an example in java of enumerating all the ip addresses on a lan and then testing which ones are active.
来源:https://stackoverflow.com/questions/8140092/is-it-possible-for-android-devices-to-exchange-messages-over-an-access-point-and