简体   繁体   中英

Finding exact device in the LAN Java / Android

I'm developing a Java application which should listen on specific port on computer using Sockets. The another app, which will run on Android device connected to the same WiFi, should find this computer with my Java program.

How can I find the computer in the network?

I've tried it in the small LAN (where are all devices connected to 192.168.*.*) using InetAddress.getByName(ipAddress).isReachable(); but in the bigger network (like eduroam or my school WiFi) I'm not able to scan whole network.

Is there another option how to connect two devices to each other apart from using Sockets and scanning whole network?

I'm not sure I understand your entire system requirements, but I'm thinking you could create a very small database at a hosting site (such as this ) and have your PC periodically upload its private IP address to that database.

Then, when you need to connect to the PC on your android device, you query the database and determine the PC's current address, then connect to the device.

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