Is it possible for android devices to exchange messages over an access point and request a list of connected devices to this AP?

北城以北 提交于 2019-12-07 23:48:01

问题


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


回答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.




回答2:


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




回答3:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!