2

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! :)

Miky
  • 942
  • 2
  • 14
  • 29
  • 1
    In addition to the good answers provided below, just a curiosity: although this is unreliable and can be overriden, when an android device connects to an AP (don't remember if it matters if it's DHCP or static), its name prefix will be "android_", followed by a serial number. Thus, a good "first hint" would be to search for those devices using one of the protocols suggested. In my experience, I haven't seen a single one that overrides this name convention. – davidcesarino Nov 15 '11 at 17:40

3 Answers3

5

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, ...).

Simon Richter
  • 28,572
  • 1
  • 42
  • 64
1

Here's an example in java of enumerating all the ip addresses on a lan and then testing which ones are active.

Kurtis Nusbaum
  • 30,445
  • 13
  • 78
  • 102
1

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.

Ivan
  • 1,735
  • 1
  • 17
  • 26