简体   繁体   中英

Connecting two android devices using wifi

I need to connect two android devices using wifi. One device is a server, which sends certain commands to second device. My question is how can I get IP address of the server from the client device? Using of some external wifi network is possible. Android.net.wifi.p2p is not acceptable for me, because it's only supported since API level 14.

UPDATE: is it possible to scan current wifi network to look for connected devices? Fe, in my case client scans its network, finds server and connects to it.

Either you have a fixed IP on the Server or u can implement some kind of Broadcast every n-time, where only your device answers.

Maybe you can send a UDP Packet with some HELLO Request to all IPs in your Subnet and when the Server receives it he responses with an ACK Paket.

If you want to check if a Device is available on the network try to ping it and then try to connect.

Try this .

Using this I am able to find DLNA devices on wifi network

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM