Re: Am I Connected (Cont)
Re: Am I Connected (Cont)
- Subject: Re: Am I Connected (Cont)
- From: "Sean Bullington" <email@hidden>
- Date: Mon, 11 Feb 2002 14:51:21 -0600
If you're looking for a way on OSX, couldn't you check the status of the
interface? Since OSX is BSD based, can't you just query an interface for
its information, such as link speed, connectivity, etc... or in the case
of ppp just see if a ppp0 or some similar interface is up? (keep in mind
this comment comes from a unix guy, not from an OSX wizard :)
It seems like there should be a more generic way to do this than simply
"pinging" a host (which may or may not be allowed through a firewall)...
or maybe something along the lines of "ok I have queried these
interfaces, I know this one is up, now I can do a more specialized
testing to see if I can use this protocol over this interface"...
sean
Jens Bauer wrote:
>
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
_______________________________________________
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.