简体   繁体   English

如何在 ios iphone swift 中获取热点连接设备的 IP 地址和 MAC 地址?

[英]how can i get hotspot connected devices ip address and MAC address in ios iphone swift?

My requirement is like, I want IP and MAC address of devices which are connected to my iOS device's hotspot.我的要求是,我想要连接到我的 iOS 设备热点的设备的 IP 和 MAC 地址。 How can I get a list of IP address of those devices?如何获取这些设备的 IP 地址列表? Does Apple allow to get hotspot related information through code.?苹果是否允许通过代码获取热点相关信息?

Unfortunately I don't know a way to get the actual client list (or ARP table for that matter).不幸的是,我不知道获取实际客户列表(或 ARP 表)的方法。

But you could implement a scanner.但是你可以实现一个扫描仪。 Have you thought of that?你有没有想过? Isn't the beautiful solution you're most probably looking for, but might be something?不是您最有可能正在寻找的美丽解决方案,但可能是某些东西吗?

Here would be a scanner library as reference: https://github.com/mavris/MMLanScan这是一个扫描器库作为参考: https : //github.com/mavris/MMLanScan

You could also get your devices IP address and network mask, calculate the possible IP range yourself and implement an ARP query per candidate device using sysctl and gethostbyaddr as described in this post您还可以获取您的设备 IP 地址和网络掩码,自己计算可能的 IP 范围并使用sysctlgethostbyaddr实现每个候选设备的 ARP 查询,如本文所述

https://stackoverflow.com/a/2269903/1041122 https://stackoverflow.com/a/2269903/1041122

EDIT sidenote: Did you have a really deep read of the NetworkExtension API from Apple?编辑旁注:您是否对 Apple 的NetworkExtension API 有深入的了解? I don't know it well but since it allows numerous configurations that might be possible as well.我不太了解它,但因为它允许多种可能的配置。

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

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