简体   繁体   English

如何获取 iOS 设备上关联接入点的 IP 地址

[英]How to get the IP address of the associated access point on an iOS device

Use Case:用例:

We have an iOS application where you can run a network test between an iOS device and its associated wireless access point to test throughput.我们有一个 iOS 应用程序,您可以在其中运行 iOS 设备及其关联的无线接入点之间的网络测试以测试吞吐量。 The app can get the IP address of the iOS device just fine, but the user has to type in the IP of the access point.该应用程序可以获取iOS设备的IP地址就好了,但是用户必须输入接入点的IP。

Problem:问题:

The task is to get the IP address of the associated access point, and pre fill it for the user, hence avoiding user intervention there.任务是获取关联接入点的 IP 地址,并为用户预先填写,从而避免用户干预。

My Approach:我的方法:

  1. Find out the Mac Address/BSSID of the access point.找出接入点的 Mac 地址/BSSID。 I do this by employing the Captive Network API.我通过使用强制网络 API 来做到这一点。

  2. Issue an ARP request to find out the IP associated to the access point.发出 ARP 请求以找出与接入点关联的 IP。 I haven't been able to accomplish this as of yet.到目前为止,我还无法做到这一点。 Google and SO search has kind of lead me to a dead end here.谷歌和 SO 搜索让我在这里陷入了死胡同。 Here are some similar questions: How do I query the ARP table on iPhone?以下是一些类似的问题: 如何在 iPhone 上查询 ARP 表? AND ARP Requests on iPhone iPhone 上的 AND ARP 请求

Question:问题:

What is the right way to do this?这样做的正确方法是什么? In fewer words, what is the best way to get the IP address of the access point an iOS device is connected to.简而言之,获取 iOS 设备所连接的接入点的 IP 地址的最佳方法是什么。

A WiFi access point is not necessarily an IP-capable device (although many of them are, but for configuration, not communications, purposes). WiFi接入点不一定是具有IP功能的设备(尽管它们中的许多是,但是用于配置,而不是通信,目的)。

Even if you do get the actual access point's IP address, how are you going to test the throughput? 即使您确实获得了实际接入点的IP地址,您将如何测试吞吐量? You could send ICMP Echo requests, but that will just give you instantaneous round-trip times, not throughput, and many IP devices, for security reasons, are configured to not respond to ICMP ECHO requests. 您可以发送ICMP Echo请求,但这只会为您提供即时往返时间,而不是吞吐量,并且出于安全原因,许多IP设备被配置为不响应ICMP ECHO请求。

BSSID is unique for each SSID on each Radio and it differs from the Access Point's Mac Address. BSSID 对于每个无线电上的每个 SSID 都是唯一的,并且与接入点的 Mac 地址不同。 If you compare them you can see last characters of Mac Adresses are different for BSSID and the AccessPoint.如果您比较它们,您会发现 Mac Adresses 的最后一个字符对于 BSSID 和 AccessPoint 是不同的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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