[futurebasic] Re: [FB] Network diagnostics

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2011 : Group Archive : Group : All Groups

From: Steve <mactech@...>
Date: Wed, 13 Jul 2011 07:38:42 -0400
This seems to work best.  It is very quick to reply if there is no connection vs. waiting for a timeout to occur.

I have only tested it by turning off Airport.  Later, I will try with Airport on, but turning off router, and then the cable modem.

One could ping 192.168.1.1 and possibly determine if a local connection [ router] is present and not the internet.

Thanks for sharing Robert.

~ steve


On Jul 11, 2011, at 6:50 PM, Robert Purves wrote:

> 
> Brian S wrote:
> 
>>>> Can someone please confirm this apparent serious bug in CFNetDiagnostics? I'm running OS X 10.6.6.
>>> 
>>> I'm getting the same interesting results as you in 10.5.8. With the DSL line disconnected from the modem, I ran the code and:
>>> 
>>> CFNetDiagnosticCopyNetworkStatusPassively()  returns -66559
>>> CFNetDiagnosticDiagnoseProblemInteractively() launches the Diagnostic.app, which then begins a connection scan using chasing arrows that stalls.
>> 
>> With the cable modem coax disconnected ( but modem powered and router powered ) the passive call returns -66559 and the snippet prints "Connected". For the interactive call, the app launches, pressed the "continue" button and it walked me through it. It finally suggests restarting the modem. The other tests all work as expected ( same as Robert ). This is OS X 10.6.8. 
> 
> I discovered IsPingable(), in the list archives for 2006. If this function returns _zTrue there can be no doubt that a connection was made.
> 
> '--------
> local fn IsPingable( server as Str255, timeout as UInt8 )
> '~'1
> dim as Str255 reply
> dim as Boolean pingable
> pingable = _false
> open "UNIX", 99, "ping -c 1 -q -t" + str$( timeout ) + " " + server
> while ( eof( 99 ) == _false )
> line input #99, reply
> if ( instr( 1, reply, "1 packets received" ) > 0 ) then pingable = _zTrue
> wend
> close 99
> end fn = pingable
> 
> include "ConsoleWindow"
> print "Testing…"
> long if ( fn IsPingable( "www.apple.com", 4 ) )
> print "Connected to internet"
> xelse
> print "Not connected"
> end if
> '--------
> 
> 
> Robert P.
> 
> 
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
> To access the list archives, go to:  http://freegroups.net/groups/futurebasic/
>