Efficient method of checking connectivity
Efficient method of checking connectivity
- Subject: Efficient method of checking connectivity
- From: Ricky Sharp <email@hidden>
- Date: Sun, 30 May 2004 19:06:58 -0500
On application startup, one of the tasks I do is:
SCNetworkConnectionFlags connectionFlags = 0;
bool isAvailable = false;
if (::SCNetworkCheckReachabilityByName (
"www.instantinteractive.com", &connectionFlags))
{
isAvailable = ((connectionFlags & kSCNetworkFlagsReachable) != 0);
}
I'm currently on a dialup connection and I've noticed that this can
cause a delay of a few seconds, especially if there is activity going
on (e.g. downloading a file).
Is there any more efficient method of determining connectivity to the
internet?
I've thought about spawning a thread on which I'll call the above, but
the SCNetwork.h file doesn't mention thread safety. I'm thinking that
such an approach will greatly cut down my app startup time. Any UI
that is brought up that needs the result of the connectivity check will
just wait for the thread. Odds are though that a decent amount of time
will occur before the user brings up any such UI.
___________________________________________________________
Ricky A. Sharp
mailto:email@hidden
Instant Interactive(tm)
http://www.instantinteractive.com
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.