Description Usage Arguments Details Value Author(s) See Also Examples
***NOTE: THIS IS A PRELIMINARY VERSION OF THIS FUNCTION; ***NOTE: IT MAY BE CHANGED OR REMOVED IN A FUTURE RELEASE.
ping a Uniform resource locator (URL) or Internet Protocol (IP) address.
NOTE: Some Internet Service Providers (ISPs) play games with "ping".
That makes the results of Ping
unreliable.
1 2 |
url |
a character string of a URL or IP address to ping. If |
pingArgs |
arguments to pass to the pingResult <- system(paste('ping', pingArgs, url), intern=TRUE, ...) |
warn |
value for |
show.output.on.console |
argument for |
1. urlSplit0 <- strsplit(url, '://')[[1]]
2. urlS0 <- urlSplit0[min(2, length(urlSplit0))]
3. host <- strsplit(urlS0, '/')[[1]][1]
4. pingCmd <- paste('ping', pingArgs, host)
5. system(pingCmd, intern=TRUE, ...)
list with the following components:
rawResults |
character vector of the raw results from the ping command |
rawNumbers |
numeric vector of the times measured |
counts |
numeric vector of numbers of packets sent, received, and lost |
p.lost |
proportion lost = lost / sent |
stats |
numeric vector of min, avg (mean), max, and mdev (standard deviation) of the measured round trip times |
Spencer Graves
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ##
## 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{)}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.