Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the current IP address using CF api from C?



Unless the linux is doing something weird, you should be able to use the same code.


On Mar 20, 2006, at 2:40 PM, Mathias Kolehmainen wrote:

I'm porting some linux code to OSX, and I'm trying to figure out how to get the current IP address. I'm using C with no gui, and so I'm using the CoreFoundation API.

Looks like I am supposed to use the configuration system. What I can't figure out from the docs is how to get a handle to the configuration system.

My first attempt used SCNetoworkInterfaceCopyAll. That seems to return proper SCNetworkInterfaceRef objects, but when I try to run SCNetworkInterfaceGetConfiguration on them it always returns a NULL dictionary.

So, what is the proper way to get into the system configuration database? And if somebody knows how to navigate to the current-ip- address property, that would be useful too.

(Am I supposed to use the IOKit? I notice the GetMACAddressSample sample code uses the IOKit...)



thanks,
-mathias




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/m0rchand% 40comcast.net


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/email@hidden

This email sent to email@hidden
References: 
 >How to get the current IP address using CF api from C? (From: Mathias Kolehmainen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.