How to get Domain Name of IP address and IP address from Domain Name in Objective C?

前端 未结 3 1325
醉酒成梦
醉酒成梦 2020-12-06 08:25

I am able to get the current IP address of my device/machine that I am using - by using this question\'s answer.

I have gone through this question. Java allows to ge

3条回答
  •  失恋的感觉
    2020-12-06 08:54

    You need to read the routing table - basically the same way as "netstat -r" command does. The netstat implementation is opensource - it's in the package

    network_cmds-396.6

    at

    http://www.opensource.apple.com/release/mac-os-x-1082/

    so you can check what it does. The default gateway contains the "G" flag but shouldn't connect the "I" flag (when both wifi and cell are active, wifi is used for internet connection - the cell gateway is not used and is given the "I" flag).

    Hope it helps.

提交回复
热议问题