nslookup: Lookup a hostname

Description Usage Arguments Examples

View source: R/nslookup.R

Description

The nslookup function is similar to nsl but works on all platforms and can resolve ipv6 addresses if supported by the OS. Default behavior raises an error if lookup fails. The has_internet function tests the internet connection by resolving a random address.

Usage

1
2
3
nslookup(host, ipv4_only = FALSE, multiple = FALSE, error = TRUE)

has_internet()

Arguments

host

a string with a hostname

ipv4_only

always return ipv4 address. Set to 'FALSE' to allow for ipv6 as well.

multiple

returns multiple ip addresses if possible

error

raise an error for failed DNS lookup. Otherwise returns NULL.

Examples

1
2
3
4
5
# Should always work if we are online
nslookup("www.r-project.org")

# If your OS supports IPv6
nslookup("ipv6.test-ipv6.com", ipv4_only = FALSE, error = FALSE)

Example output

[1] "137.208.57.37"
[1] "2001:470:1:18::125"

curl documentation built on May 2, 2019, 2:40 a.m.