LispWorks User Guide and Reference Manual > 26 The COMM Package

NextPrevUpTopContentsIndex

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:

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.

Note: although the results of get-host-entry are not cached by LispWorks, the operating System might cache them.

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 User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex