r-lib / pingr Goto Github PK
View Code? Open in Web Editor NEWICMP and TCP ping and related tools
Home Page: http://r-lib.github.io/pingr/
License: Other
ICMP and TCP ping and related tools
Home Page: http://r-lib.github.io/pingr/
License: Other
Need to connect in non-blocking mode, wait until connected, or the timeout is up, and then switch back to blocking mode. Maybe we don't even have to switch back....
Windows, R 4.0.0
ping("www.google.com")
[1] NA NA NA
> ping_port("www.google.com")
[1] 18.002 30.007 23.161
Is this "expected behavior"?
checking tests ... ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
LENGTH or similar applied to closure object
1: withCallingHandlers(eval(code, new_test_environment), error = capture_calls, message = function(c) invokeRestart("muffleMessage"),
warning = function(c) invokeRestart("muffleWarning"))
2: eval(code, new_test_environment)
3: eval(expr, envir, enclos)
4: ping_port("127.0.0.1", port = tools:::httpdPort, count = 1) at test-tcp.r:13
testthat results ================================================================
OK: 15 SKIPPED: 0 FAILED: 1
1. Error: We can ping localhost
Error: testthat unit tests failed
Execution halted
Hi @gaborcsardi, I see that the license is declared in the bottom of the README, but would it be possible to update the LICENSE file to include the text of the MIT license so that GitHub picks it up and reports it properly?
I see
checking tests ... ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
1. Error: We can ping localhost ------------------------------------------------
LENGTH or similar applied to closure object
1: withCallingHandlers(eval(code, new_test_environment), error = capture_calls, message = function(c) invokeRestart("muffleMessage"))
2: eval(code, new_test_environment)
3: eval(expr, envir, enclos)
4: ping_port("127.0.0.1", port = tools:::httpdPort, count = 1) at test-tcp.r:13
testthat results ================================================================
OK: 15 SKIPPED: 0 FAILED: 1
1. Error: We can ping localhost
Error: testthat unit tests failed
Execution halted
Because the various ping programs work differently, e.g. take different arguments, etc.
usethis::use_readme_rmd()
usethis::use_roxygen_md()
usethis::use_github_links()
usethis::use_pkgdown_github_pages()
usethis::use_tidy_github_labels()
usethis::use_tidy_style()
urlchecker::url_check()
usethis::use_package_doc()
usethis::use_testthat(3)
R/
files and test/
filescran-comments.md
master
--> main
issuesusethis:::use_codecov_badge("r-lib/pingr")
usethis::use_lifecycle()
person("Posit Software, PBC", role = c("cph", "fnd"))
devtools::document()
to re-generate package-level help topic with DESCRIPTION changesusethis::use_tidy_logo()
usethis::use_tidy_coc()
pak::pak("r-lib/pingr")
in READMEusethis::use_tidy_dependencies()
and/or replace compat files with use_standalone()
.r
to .R
in R/
and/or tests/testthat/
usethis::use_mit_license()
usethis::use_package("R", "Depends", "3.6")
usethis::use_tidy_description()
usethis::use_tidy_github_actions()
devtools::build_readme()
Created on 2023-11-03 with usethis::use_tidy_upkeep_issue()
, using usethis v2.2.2.9000
I don't know whether this also affects windows users, but the sys call to ping
on linux is executed with timeout * 1000
passed to -W
argument. My man ping
(ubuntu 16.04) says:
-W timeout
Time to wait for a response, in **seconds**. The option affects only timeout in
absence of any responses, otherwise ping waits for two RTTs.
Therefore calling ping('lalala.com')
dead-locks the R session (ok, actually, only affects Rstudio, and not the terminal, but nonetheless).
The documentation does not say anything about the measurement units, and the default for timeout
argument is set to 1
,
IMO, two things should be changed:
The master
branch of this repository will soon be renamed to main
, as part of a coordinated change across several GitHub organizations (including, but not limited to: tidyverse, r-lib, tidymodels, and sol-eng). We anticipate this will happen by the end of September 2021.
That will be preceded by a release of the usethis package, which will gain some functionality around detecting and adapting to a renamed default branch. There will also be a blog post at the time of this master
--> main
change.
The purpose of this issue is to:
message id: euphoric_snowdog
Print and count at the same time
-lresolv
is not needed for FreeBSD since it is in libc. So,
Line 1 in bfe03f4
Makevars
enough to have a platform-specific fix there.Prepare for release:
git pull
usethis::use_github_links()
urlchecker::url_check()
devtools::build_readme()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
revdepcheck::revdep_check(num_workers = 8)
cran-comments.md
git push
Submit to CRAN:
usethis::use_version('patch')
devtools::submit_cran()
Wait for CRAN...
usethis::use_github_release()
usethis::use_dev_version(push = TRUE)
It would be nice to be able to utilize these functions within a data.frame but I think some of the checks are causing it to fail. Here is an example.
data <- data.frame(
id = 1:3,
dmarc_string = c("_dmarc.google.com", "_dmarc.shopify.com", "_dmarc.walmart.com")
)
update_df <- data |>
dplyr::mutate(
dmarc_record = pingr::nsl(domain=dmarc_string, type=16L)[["answer"]]["data"]
)
Error: Problem with `mutate()` column `dmarc_record`.
i `dmarc_record = pingr::nsl(domain = dmarc_string, type = 16L)[["answer"]]["data"]`.
x is_string(domain) is not TRUE
As stated in the R doc ping gives response time in seconds while it is not clearly specified for ping_port. According to the c code the result should be in ms.
hi @gaborcsardi,
It seems it is not possible to suppress either warnings or messages from is_online()
, perhaps because they are neither. Still, it would be nice to be able to quiet is_online()
...
> suppressMessages(pingr::is_online())
ping: google-public-dns-a.google.com: Temporary failure in name resolution
ping: b.resolvers.Level3.net: Temporary failure in name resolution
connect: Network is unreachable
connect: Network is unreachable
[1] FALSE
> suppressWarnings(pingr::is_online())
ping: google-public-dns-a.google.com: Temporary failure in name resolution
ping: b.resolvers.Level3.net: Temporary failure in name resolution
connect: Network is unreachable
connect: Network is unreachable
[1] FALSE
I believe this results from using the system()
function:
Line 65 in 6da0940
Could you not change that system
call to:
output <- suppressWarnings(
system(os$cmd, intern = ! verbose,
ignore.stdout = TRUE, ignore.stderr = TRUE)
)
Can I use some pingr function to leave my RStudio online? When I use the is.online () command, the answer is FALSE.
response times <1ms don't fit into the timings
regex:
os$regex
[1] "^.*time=(.+)[ ]?ms.*$"
Pre-history
usethis::use_readme_rmd()
usethis::use_roxygen_md()
usethis::use_github_links()
usethis::use_pkgdown_github_pages()
usethis::use_tidy_github_labels()
usethis::use_tidy_style()
usethis::use_tidy_description()
urlchecker::url_check()
2020
usethis::use_package_doc()
@importFrom
directives here.usethis::use_import_from()
is handy for this.usethis::use_testthat(3)
and upgrade to 3e, testthat 3e vignetteR/
files and test/
files for workflow happiness.usethis::rename_files()
can be helpful.2021
usethis::use_tidy_dependencies()
usethis::use_tidy_github_actions()
and update artisanal actions to use setup-r-dependencies
cran-comments.md
2022
usethis::use_tidy_coc()
master
--> main
issuesdevelopment
is mode: auto
in pkgdown configCould support for parsing SRV records be added to nsl()
?
I've been looking for a self-contained way to query SRV records, ultimately to enable shiny apps to find plumber API endpoints in a micro-services environment. pingr::nsl()
is allllmost there. 😄
Prepare for release:
git pull
devtools::build_readme()
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
rhub::check_for_cran()
rhub::check(platform = 'ubuntu-rchk')
rhub::check_with_sanitizers()
revdepcheck::revdep_check(num_workers = 8)
cran-comments.md
git push
Submit to CRAN:
usethis::use_version('patch')
devtools::submit_cran()
Wait for CRAN...
git push
usethis::use_github_release()
usethis::use_dev_version()
git push
Version: 2.0.2
Check: whether package can be installed
Result: WARN
Found the following significant warnings:
rping.c:101:13: warning: too many arguments for format [-Wformat-extra-args]
See ‘/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/pingr.Rcheck/00install.out’ for details.
* used C compiler: ‘gcc-13 (Debian 13.2.0-5) 13.2.0’
Flavor: [r-devel-linux-x86_64-debian-gcc](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/pingr-00check.html)
For the cases where DNS is not masked, but HTTP is.
would a function assessing the internet connection be in scope for this package?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.