Re: Network Reachability
Re: Network Reachability
- Subject: Re: Network Reachability
- From: Jens Alfke <email@hidden>
- Date: Thu, 28 Jan 2010 22:38:14 -0800
On Jan 28, 2010, at 9:22 PM, Laurent Daudelin wrote:
> host = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostName);
> assert(host != NULL);
>
> SCNetworkReachabilityRef target = SCNetworkReachabilityCreateWithName(NULL, [hostName cStringUsingEncoding:NSUTF8StringEncoding]);
It seems redundant to convert the hostname string into a CFHost and then back into a string. Have you verified that you're getting a reasonable C string at the end?
> SCNetworkReachabilityGetFlags(target, &flags);
Try checking the error code this returns. All the examples I've seen do this asynchronously by setting up a runloop-based callback; I'm not certain that the flags are valid immediately after you create the ref.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden