{"id":19278112,"url":"https://github.com/r-lib/pingr","last_synced_at":"2025-04-05T06:06:50.183Z","repository":{"id":21002743,"uuid":"24293304","full_name":"r-lib/pingr","owner":"r-lib","description":"ICMP and TCP ping and related tools","archived":false,"fork":false,"pushed_at":"2024-12-12T11:54:00.000Z","size":5561,"stargazers_count":35,"open_issues_count":6,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T15:25:36.870Z","etag":null,"topics":["dns","is-online","ping","r","tcp"],"latest_commit_sha":null,"homepage":"http://r-lib.github.io/pingr/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-21T14:36:10.000Z","updated_at":"2025-03-22T08:13:26.000Z","dependencies_parsed_at":"2024-06-19T04:09:55.281Z","dependency_job_id":"f42848e4-2408-4120-a8c8-6dec202a4666","html_url":"https://github.com/r-lib/pingr","commit_stats":{"total_commits":126,"total_committers":2,"mean_commits":63.0,"dds":"0.015873015873015928","last_synced_commit":"97482c29f38a1db239bc04481f5ce95ca095fbbe"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpingr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpingr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpingr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fpingr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/pingr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294536,"owners_count":20915340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dns","is-online","ping","r","tcp"],"created_at":"2024-11-09T21:07:56.618Z","updated_at":"2025-04-05T06:06:50.158Z","avatar_url":"https://github.com/r-lib.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"\n```{r, setup, echo = FALSE, message = FALSE}\nknitr::opts_chunk$set(\n  comment = \"#\u003e\",\n  tidy = FALSE,\n  error = FALSE,\n  fig.width = 8,\n  fig.height = 8)\n```\n\n\u003c!-- badges: start --\u003e\n[![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)\n[![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)\n[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/pingr)](https://r-pkg.org/pkg/pingr)\n\u003c!-- badges: end --\u003e\n\n# pingr: check if a server is alive\n\nThe pingr package has tools to check if a remote computer or web server is\nup and some other related tools.\n\n## Installation\n\nInstall the package from CRAN:\n\n```r\ninstall.packages(\"pingr\")\n```\n\nIf you need the development version, install it from GitHub:\n\n```r\npak::pak(\"r-lib/pingr\")\n```\n\n## ICMP ping\n\nThe `ping()` function does ICMP ping, via the system's `ping` utility:\n\n```{r}\nlibrary(pingr)\nping(\"127.0.0.1\")\n```\n\nBy default it sends three packets and measures the time it receives and answer.\nIt waits between sending out the packets, so if you want a really quick check,\nyou can just send a single packet:\n\n```{r}\nping(\"127.0.0.1\", count = 1)\n```\n\nIf a machine is down (or it does not exist), then `NA` is returned instead\nof the roundtrip time:\n\n```{r}\nping(\"192.0.2.1\", count = 1)\n```\n\n## TCP ping\n\nWith TCP ping we can check if a machine is listeing on a TCP port, e.g. if\ngoogle's search web server is up and running:\n\n```{r}\nping_port(\"www.google.com\", port = 80, count = 1)\n```\n\n## Query the public IP address of the computer\n\n`my_ip()` queries the public IP of the computer, either via DNS or HTTPS:\n\n```{r}\nmy_ip()\n```\n\n## Check if the computer is online\n\n`is_online()` checks if the computer is online. It makes three tries:\n\n* Queries myip.opendns.com on OpenDNS, see `my_ip()`.\n* Retrieves icanhazip.com via HTTPS, see `my_ip()`.\n* Retrieve Apple's Captive Portal test page, see `apple_captive_test()`.\n\nIf any of these are successful, it returns `TRUE`.\n\n```{r}\nis_online()\n```\n\n## DNS queries\n\nThe package also contains a function to perform DNS queries. This is a\nmore portable and more functional version of the `utils::nsl()` function:\n\n```{r}\nnsl(\"www.r-project.org\", type = 1L)\nnsl(\"google.com\", type = 28L)\n```\n\n## License\n\nMIT © RStudio\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fpingr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fpingr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fpingr/lists"}