[futurebasic] Re: [FB] Network diagnostics

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

From: Robert Purves <listrp@...>
Date: Tue, 12 Jul 2011 10:50:16 +1200
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.