In system network preference there are some location names.How to get the current or active network location name and list of all network locations?
I guess SystemConfiguration.framework supports this but i didn't get exactly which API to use.
Thanks in advance for your answer.
Regards
Devara Gudda
views:
88answers:
1
+2
A:
You can use SCPreferencesCreate
to get the preferences, then SCNetworkSetCopyAll
to get just the network locations. SCNetworkSetGetName
will get the name of a location.
SCPreferencesRef prefs = SCPreferencesCreate(NULL, @"SystemConfiguration", NULL);
NSArray *locations = (NSArray *)SCNetworkSetCopyAll(prefs);
for (id item in locations) {
NSString *name = (NSString *)SCNetworkSetGetName((SCNetworkSetRef)item);
...
}
CFRelease(locations);
CFRelease(prefs);
Read "System Configuration Programming Guidelines" for more.
outis
2010-04-03 13:03:16
Thanks it's working.I am using SCNetworkSetCopyCurrent to get the current n/w location.
Devara Gudda
2010-04-04 05:38:11