Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-lib/pingr
ICMP and TCP ping and related tools
https://github.com/r-lib/pingr
dns is-online ping r tcp
Last synced: about 7 hours ago
JSON representation
ICMP and TCP ping and related tools
- Host: GitHub
- URL: https://github.com/r-lib/pingr
- Owner: r-lib
- License: other
- Created: 2014-09-21T14:36:10.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T08:50:55.000Z (3 months ago)
- Last Synced: 2024-10-29T09:55:57.136Z (3 months ago)
- Topics: dns, is-online, ping, r, tcp
- Language: C
- Homepage: http://r-lib.github.io/pingr/
- Size: 4.71 MB
- Stars: 34
- Watchers: 4
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - r-lib/pingr - ICMP and TCP ping and related tools (C)
README
```{r, setup, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
comment = "#>",
tidy = FALSE,
error = FALSE,
fig.width = 8,
fig.height = 8)
```[![R-CMD-check](https://github.com/r-lib/pingr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/pingr/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/r-lib/pingr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/pingr?branch=main)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/pingr)](https://r-pkg.org/pkg/pingr)# pingr: check if a server is alive
The pingr package has tools to check if a remote computer or web server is
up and some other related tools.## Installation
Install the package from CRAN:
```r
install.packages("pingr")
```If you need the development version, install it from GitHub:
```r
pak::pak("r-lib/pingr")
```## ICMP ping
The `ping()` function does ICMP ping, via the system's `ping` utility:
```{r}
library(pingr)
ping("127.0.0.1")
```By default it sends three packets and measures the time it receives and answer.
It waits between sending out the packets, so if you want a really quick check,
you can just send a single packet:```{r}
ping("127.0.0.1", count = 1)
```If a machine is down (or it does not exist), then `NA` is returned instead
of the roundtrip time:```{r}
ping("192.0.2.1", count = 1)
```## TCP ping
With TCP ping we can check if a machine is listeing on a TCP port, e.g. if
google's search web server is up and running:```{r}
ping_port("www.google.com", port = 80, count = 1)
```## Query the public IP address of the computer
`my_ip()` queries the public IP of the computer, either via DNS or HTTPS:
```{r}
my_ip()
```## Check if the computer is online
`is_online()` checks if the computer is online. It makes three tries:
* Queries myip.opendns.com on OpenDNS, see `my_ip()`.
* Retrieves icanhazip.com via HTTPS, see `my_ip()`.
* Retrieve Apple's Captive Portal test page, see `apple_captive_test()`.If any of these are successful, it returns `TRUE`.
```{r}
is_online()
```## DNS queries
The package also contains a function to perform DNS queries. This is a
more portable and more functional version of the `utils::nsl()` function:```{r}
nsl("www.r-project.org", type = 1L)
nsl("google.com", type = 28L)
```## License
MIT © RStudio