this script uses ping to get an echo back from a server; the text from ping might be a little different on various OS flavors and the test for "Received = 1" might need adjusting. n=1 means only ping once, w=100 means don't wait more than 100ms. The mac version will be different, this is (barely) tested on windows.
Ping is named after the sound submarine sonars make...then listen for the echo. But unlike a real echo, other delays are possible with busy computers. Your ping might easily pass through five or more computers, and the echo will be similar. You can play with ping in a "dos box" like this:
Using ping in a "dos box"
isAvailable = Function( {resource},
{default local},
Contains( RunProgram( executable( "ping" ), options( {"-n 1 -w 100", resource} ), readfunction( "text" ) ), "Received = 1" ) != 0
);
// this succeeds in < .1 second
start = Tick Seconds();
jmp = isAvailable( "jmp.com" );
stop = Tick Seconds();
Show( jmp, stop - start );
// this fails in about 3 seconds
start = Tick Seconds();
fileserver = isAvailable( "jmpsserver" ); // leave out the back slashes and use the first name
stop = Tick Seconds();
Show( fileserver, stop - start );
// this fails in about .2 seconds
start = Tick Seconds();
nonesuch = isAvailable( "x" || Char( Random Integer( 1e15, 9e15 ) ) || ".com" );
stop = Tick Seconds();
Show( nonesuch, stop - start );
jmp = 1; -- jmp.com works
stop - start = 0.0333333333255723;
fileserver = 0; -- that isn't our file server name
stop - start = 2.26666666672099;
nonesuch = 0; -- that isn't likely to be a real web name
stop - start = 0.0500000000465661;
Craige