I am trying to implement an "update checker" R code snippet where the updates are provided via a network computer.
How can I find out via R code if the computer has an active network connection?
Non-functional requirements:
- must work fast (no long timeout)
- low package dependencies
- should be OS independent (no use
systemshell commands) - the solution should (= nice to have) not depend on firewall settings (which may "fake" eg. ping responses)
- the solution should not use public internet addresses like google for privacy reasons
Is there a package or a code snippet for that? Any hint is welcome :-)
PS: Currently my best approach is using
pingr::is_up("ip.or.URI", fail_on_dns_error = T, timeout = 0.25)
but if I am completely offline (WLAN disabled) the timeout is still not respected on my Windows computer and takes about 10 seconds.
PS 2: Other "tricks" like download.file do even take longer to time out (30 s)...