Re: Am I Connected (Cont)
Re: Am I Connected (Cont)
- Subject: Re: Am I Connected (Cont)
- From: Jens Bauer <email@hidden>
- Date: Mon, 11 Feb 2002 20:40:30 +0100
Hi John,
You may find the OTPingSample very interesting.
-Another simple approach would be to ping your DNS, however, please make
sure that the modem will not dial before doing so.
On Mon, 11 Feb, 2002, John Cebasek <email@hidden> wrote:
>
Hi Quinn:
>
>
Talking to the other folks in how they would do this, it seems one
>
approach would be to send an ECHO command/packet/whatever to a known address
>
and if the round trip time is > 0, then we're online and connected to the
>
'net.
>
>
I thought that there would be a simpler way to do this, and came up
>
with:
>
>
> static Boolean ConnectedToInternet(void)
>
> {
>
>
>
> InetSvcRef internetServices = kOTInvalidProviderRef;
>
> OSStatus osErr = noErr;
>
> Boolean bResult = false;
>
> internetServices = OTOpenInternetServices(kDefaultInternetServices,
>
> 0,
>
&osErr);
>
>
if (osErr == noErr)
>
{
>
> bResult = true; // Yippee! We're connected!
>
> OTCloseProvider(internetServices);
>
>
>
> }
>
> return bResult;
>
> }
>
>
>
> My idea was that if OTOpenInternetServices worked, then the user
>
> configuration was correct, and we can get to 'the wall'. I wasn't really
>
> sure about needing a target to try and reach...
>
>
>
> Except for the fact that OTOpenInternetServices isn't in carbon. Which
>
> now
>
> has me looking thru tn1173.
>
>
>
> Also, if tn1145 is for OS 9, and those System Config calls are for X, does
>
> it mean that there isn't a solution that covers both OSes? We're a
>
> powerplant app and I've got carbonized GUSI in there now which seems to be
>
> doing quite a bit of the work we need in regards to getting data down from
>
> the server in my test harnesses.
>
>
>
Well, that's my flaky logic... such that it is...
Love,
Jens
--
Jens Bauer, Faster Software.
_______________________________________________
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.