Get IP address of the current Wi-Fi access point on a iPhone?

后端 未结 2 1948
生来不讨喜
生来不讨喜 2021-01-03 10:09

I am trying to connect from my iPhone to a socket server running on the same network on my computer. How can I get the local IP address of the computer that is running the s

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-03 10:17

    Your server needs to broadcast itself using the mDNS protocol.

    Then on the iPhone, you can simply use gethostbyname to get the IP address. You also have a specific API for that: DNS Service Discovery C Reference.

提交回复
热议问题