Re: SCNetworkCheckReachabilityByName
Re: SCNetworkCheckReachabilityByName
- Subject: Re: SCNetworkCheckReachabilityByName
- From: m <email@hidden>
- Date: Thu, 29 Apr 2004 14:14:06 -0700
- Resent-date: Thu, 29 Apr 2004 14:14:36 -0700
- Resent-from: m <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: Cocoa Dev <email@hidden>
Search the archives. I posted some code a few weeks back that
definitely works. Note also that the form of your string can affect the
results. My code shows the correct form.
_murat
On Apr 29, 2004, at 1:17 PM, Daniel Todd Currie wrote:
I'm having trouble with SCNetworkCheckReachabilityByName... Here is
my implementation:
+ (void)checkVersionAt:(NSString *)versionURLString
withProductPage:(NSString *)productPageURLString
andApplyToWindow:(NSWindow *)versionAlertWindow
showAlerts:(BOOL)showAlerts
{
...
NSLog(@"reachability start");
BOOL success, reachable = 0;
SCNetworkConnectionFlags flags;
success = SCNetworkCheckReachabilityByName([versionURLString
UTF8String], &flags);
if((flags & kSCNetworkFlagsReachable) && !(flags &
kSCNetworkFlagsConnectionRequired))
{
reachable = 1;
}
NSLog(@"reachability finish = %i %i", success, reachable);
...
}
However, this code always logs the following:
2004-04-29 13:02:53.170 DTCVM Example[1376] reachability start
2004-04-29 13:02:57.323 DTCVM Example[1376] reachability finish = 1 0
My network connection is stable, and I am certain that the URL in
versionURLString is valid, since I continue to read the data in that
URL, regardless of the results of SCNetworkCheckReachabilityByName. I
am hooked up directly to my DSL modem, so I am certain it is not a
firewall/etc. issue.
Any ideas would be greatly appreciated.
-- Daniel Currie
PS: Another question is why on earth does the reachability stuff take
over 4 seconds on my 768k DSL and 1.33 GHz G4? I don't expect an
answer for that one though...
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.