Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何获取同一网络上所有机器的所有主机名?是否有任何用于此类任务的 Obj-C 库?我正在使用 GCDAsyncSocket lib 通过 UDP 进行通信,现在我想列出应用程序中的所有可用主机(或至少 IP 地址),而不必手动输入 IP 地址。
简而言之,你不能。TCP/IP 网络不是这样工作的。
如果你想自动发现服务,你应该使用Bonjour。