• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Network Reachability
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Network Reachability
      • From: Laurent Daudelin <email@hidden>
References: 
 >Network Reachability (From: Laurent Daudelin <email@hidden>)

  • Prev by Date: Re: IKImageBrowserView drop operation always highlighting a specific row
  • Next by Date: Node hierarchy with subclasses
  • Previous by thread: Network Reachability
  • Next by thread: Re: Network Reachability
  • Index(es):
    • Date
    • Thread