Re: Network Reachability

2010-01-30 Thread Michael Ash
On Fri, Jan 29, 2010 at 2:37 PM, Jens Alfke wrote: > > On Jan 29, 2010, at 11:12 AM, Laurent Daudelin wrote: > >> 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 wh

Re: Network Reachability

2010-01-29 Thread Jens Alfke
On Jan 29, 2010, at 11:12 AM, Laurent Daudelin wrote: > 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. This can be confusing. Connecti

Re: Network Reachability

2010-01-29 Thread Laurent Daudelin
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 = >> SCNetworkReachabilityCreateWithN

Re: Network Reachability

2010-01-28 Thread Jens Alfke
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:NSUTF8Str

Network Reachability

2010-01-28 Thread Laurent Daudelin
Hello. Earlier this week, I asked how I could determine network reachability from my app. Someone replied to check the SystemConfiguration framework. I finally got around to have a look and wrote the following code: + (BOOL)hostIsReachable:(NSString *)hostName { CFHostRefhost

Re: Network Reachability APIs

2009-05-21 Thread Kirk Kerekes
I may have missed it, but I think that an essential point about the Reachability API has been left unmentioned: The OS Reachability API does its work without annoying the user -- something that is quite difficult to guarantee with roll-your-own versions. Believe it or not, there are still d

Re: Network Reachability APIs

2009-05-20 Thread Greg Parker
On May 20, 2009, at 2:03 PM, Eric Hermanson wrote: I think that's precisely my point. If I have to manage the data transfer mechanism independently of the Reachability APIs in the first place, then that was why I asked the question, why use the Reachability APIs at all? I guess that was th

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
Fair enough. My application is so network intensive that I really don't have the luxury of having a bad network connection in the first place. If we want to talk APIs, I wish Apple would provide Cocoa APIs for things like socket timeout and reconnecting a socket that may have lost its con

Re: Network Reachability APIs

2009-05-20 Thread Kyle Sluder
On Wed, May 20, 2009 at 4:56 PM, Eric Hermanson wrote: > I'm not so sure it's poppycock.  The asynchronous IO APIs all do the work in > a background thread (or a 'simulated' background via a run loop).  Either > way the IO is not blocking the main application thread when it is working. >  So I don

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
x27;s why God invented APIs. Luke On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/ output stream) and observe the EOF notices from the socket to determine network a

Re: Network Reachability APIs

2009-05-20 Thread Luke the Hiesterman
u'd just be reinventing the wheel. That's why God invented APIs. Luke On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/ output stream) and observe

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
I'm not so sure it's poppycock. The asynchronous IO APIs all do the work in a background thread (or a 'simulated' background via a run loop). Either way the IO is not blocking the main application thread when it is working. So I don't think the concept that correct IO is IO that is done

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
s callback when your target becomes reachable, thereby simplifying your code. You could write something to do that yourself, but then you'd just be reinventing the wheel. That's why God invented APIs. Luke On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what

Re: Network Reachability APIs

2009-05-20 Thread Alex Kac
We have an app with a UISwitch that we show/hide depending on if there is a WiFi network available or not. Since its a simple delegate call, it makes it easy. On May 20, 2009, at 2:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when on

Re: Network Reachability APIs

2009-05-20 Thread Kyle Sluder
On Wed, May 20, 2009 at 4:21 PM, Eric Hermanson wrote: > I understand what you are saying, but if you do IO correctly you'll do it in > a background thread anyway. Poppycock. Why do you think non-blocking synchronization primitives exist? > So waiting on a blocking socket until it times > out o

Re: Network Reachability APIs

2009-05-20 Thread Luke the Hiesterman
ourself, but then you'd just be reinventing the wheel. That's why God invented APIs. Luke On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream)

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
;d just be reinventing the wheel. That's why God invented APIs. Luke On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream) and observe the EOF

Re: Network Reachability APIs

2009-05-20 Thread Luke the Hiesterman
ourself, but then you'd just be reinventing the wheel. That's why God invented APIs. Luke On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream) and observe the EOF notices from the socket to determine network availability & reachabil

Re: Network Reachability APIs

2009-05-20 Thread Luke the Hiesterman
nting the wheel. That's why God invented APIs. Luke On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream) and observe the EOF notices from the sock

Network Reachability APIs

2009-05-20 Thread Eric Hermanson
On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream) and observe the EOF notices from the socket to determine network availability & reachability? In other words, if a network connection has to be ma