Determining current IPv4 WiFi address of iOS device?
Determining current IPv4 WiFi address of iOS device?
- Subject: Determining current IPv4 WiFi address of iOS device?
- From: Jens Alfke <email@hidden>
- Date: Tue, 08 Oct 2013 11:49:53 -0700
Short question: How do I get the current IPv4 address of the WiFi interface of an iOS device?
Why? I have a test app running on an iPhone, that runs an HTTP listener. Another test tool running on a desktop machine needs to send HTTP requests to this test app. The test tool needs to be given a URL, so I want to display the URL in the main screen of the test app so it can be entered into the desktop tool. (I am not interested in hearing about mDNS/Bonjour based alternatives. They’re not what I need right now. Thanks.)
What I’ve done: I dug up some code I wrote a few years ago that calls getifaddrs to find the addresses of all interfaces. Unfortunately I don’t have enough POSIX-network-API fu to determine which of the addresses is WiFi and which is cellular. (I also have a feeling that I must be overlooking a higher-level API for this, although neither CFHost nor SystemConfiguration seem to do what I want.)
Thanks,
—Jens |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden