Get IP from wifi hotspot in android

前端 未结 2 755
北海茫月
北海茫月 2021-02-10 18:40

I want to get IP of wifi hotspot (from another computer) that android device connect via wifi, not IP local of android. I run application in real device

相关标签:
2条回答
  • 2021-02-10 18:46

    Not all WiFi access points even have IP addresses! It is not a requirement. It runs on a different layer.

    That being said, you can use reverse-ARP on the wireless MAC of the AP to get its IP address, if it has one. Also note that this IP is sometimes different than the wired interface.

    For home all-in-one wireless routers, you can also check whatever DHCP assigns as a gateway address, but again, this doesn't have a direct correlation to the access point.

    0 讨论(0)
  • 2021-02-10 19:02

    If you are using default subnets then a host Ip address of 192.168.2.101 directly implies an access point address of 192.168.2.1. Your IP address is group C. So for Any address x.x.x.y in this group, the subnet itself is x.x.x.0 and the first host address x.x.x.1 is assigned to the access point. All other addresses: x.x.x.2 to x.x.x.254 are assigned to connected hosts and x.x.x.255 is the local broadcast address.

    0 讨论(0)
提交回复
热议问题