hostname2ip: hostname2ip

View source: R/hostname2ip.r

hostname2ipR Documentation

hostname2ip

Description

Converts a hostname (or vector of hostnames) to

Usage

hostname2ip(hosts)

Arguments

hosts

A vector of hostnames as strings (or just one).

Details

Only IPv4 addresses will be returned. If only IPv6 addresses exist (and if that is the case, allow me to be the first to greet you, person from the distant future) then NA is returned for that hostname.

The function uses getaddrinfo() on *NIX systems, and gethostbyname() on Windows.

Value

A list of vectors of IP's. Each IP is stored as a string.

Examples

library(getip)


hosts = c("www.google.com", "localhost", "www.yahoo.com")
hostname2ip(hosts)



wrathematics/getip documentation built on Jan. 28, 2024, 12:12 p.m.