# NOT RUN {
##
## Some ISPs play games with ping.
## Therefore, the results are not reliable.
##
# }
# NOT RUN {
##
## good
##
(google <- Ping('http://google.com/ping works on host not pages'))
\dontshow{stopifnot(}
with(google, (counts[1]>0) && (counts[3]<1))
\dontshow{)}
##
## ping oops <<-- at one time, this failed.
## However, with some ISPs, it works, so don't test it.
##
##
(couldnotfindhost <- Ping('oops'))
\dontshow{stopifnot(}
with(couldnotfindhost,
length(grep('could not find host', rawResults))>0)
\dontshow{)}
##
## impossible, but not so obvious
##
(requesttimedout <- Ping('requesttimedout.com'))
\dontshow{stopifnot(}
with(requesttimedout, (counts[1]>0) && (counts[2]<1) &&
(counts[3]>0))
\dontshow{)}
# }
Run the code above in your browser using DataLab