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)



getip documentation built on June 22, 2024, 6:52 p.m.