0

I want to connect multiple android phones to PC via Wi-Fi. To implement this, I've created a hotspot on my PC using Connectify and have connected all phones to it.Now, in order to communicate with PC, i need its IP address.

I've researched a lot and found ways to find IP address of phone but not Wi-fi hotspot. Please help me out.

Gaurav Arora
  • 17,124
  • 5
  • 33
  • 44
  • You need the gateway address http://stackoverflow.com/questions/5387036/how-to-get-gateway-and-subnet-mask-details-in-android-programmatically – Ofir Feb 20 '12 at 07:43

2 Answers2

1

Probably you use a server app on PC side. In this case:

  1. Create a any UDP port and keep it opened all time.
  2. Use UDP port discovery process to find the target PC in a network.

Use this method you can always find a target PC also in a standalone WiFi networks. Also I suggest to use a usefull Kryonet library which provides a discoverHost method.

Oleksii Masnyi
  • 2,922
  • 2
  • 22
  • 27
-1
ArrayList<ClientScanResult> clients = wifiApManager.getClientList(false);

    for (ClientScanResult clientScanResult : clients) 
    {
    wifi_ip = "IpAddr: " + clientScanResult.getIpAddr() ;

    }

This will get you the IP Address of the wifi hotspot

GK_
  • 1,212
  • 1
  • 12
  • 26