On Jan 28, 2010, at 22:38, Jens Alfke wrote:

> 
> 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


Jens,

The function doesn't return any error. I was able to determined that when the 
connection is down, I found out that kSCNetworkFlagsConnectionRequired was 
true, so it seems to work. It's just difficult to determine what exactly the 
flags mean. The examples CFHostSample and SimpleReach simply displays the value 
of the various flags returned.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin                                 
http://nemesys.dyndns.org
Logiciels Nemesys Software                                              
[email protected]
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries



_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to