Next Prev Up Top Contents Index

get-host-entry

 
Function
Summary

Returns address or name information about a given host.

Package

comm

Signature

get-host-entry host &key fields => field-values

Arguments

host

A number or a string.

fields

A list of keywords.

Values

field-values

Values, one for each field.

Description

Using whatever host naming services are configured on the current machine, get-host-entry returns address or name information about the given host. nil is returned if the host is unknown.

The host argument can be one of the following:

a name string, for example "www.foobar.com"

a dotted inet address string, for example "209.130.14.246"

a integer representing the inet address, for example #xD1820EF6

The fields argument is a list of keywords describing what information to return for the host. If get-host-entry succeeds, it returns multiple values, one value for each field specified. The following fields are allowed:

:address

The primary IP address as an integer.

:addresses

A list of all the IP addresses as integers.

:name

The primary name as a string.

:aliases

The alias names as a list of strings.

Examples
CL-USER 16 > (comm:get-host-entry "www.altavista.com" 
                                  :fields '(:address))
3511264349
 
CL-USER 17 > (comm:get-host-entry 3511264349 
                                  :fields '(:name))
"altavista.com"
 
CL-USER 18 > (comm:get-host-entry "altavista.com" 
                                  :fields '(:name 
                                            :address 
                                            :aliases))
"altavista.com"
3511264349
("www.altavista.com" "www.altavista.com")

LispWorks Reference Manual - 13 Jun 2003

Next Prev Up Top Contents Index