Address Info API

This CHICKEN module exposes getaddrinfo(3) functionality to Scheme.

  (import address-info)

Address Info Record

  (define-record-type address-info
    (make-address-info family type host port)
    [family address-info-family]
    [type address-info-type]
    [host address-info-host]
    [port address-info-port])

Descriptor for an internet socket address. The family is either 'ipv4 or 'ipv6. The type is either 'tcp, 'udp or 'raw. The host is a numeric address encoded as a string. The port is a either a positive integer or #f.

Address Info Lookup

   HOST [#:port PORT]
   [#:family FAMILY] [#:type TYPE]
   [#:server? BOOLEAN] [#:numeric? BOOLEAN])
  => (list ADDRESS-INFO ...) | #f

Tries to lookup socket addresses for the given host and/or port. If the lookup is successful, the procedure returns a list of address information records. Otherwise it returns #f.

For a successful lookup you must at least specify a hostname or a port. If no hostname is specified, the function defaults to server mode lookup and will return wildcard addresses. This behaviour can be changed using the #:server? flag.

By default, the procedure will return address information records for all suitable supported protocol families and socket types. The #:family argument may be used to filter for 'ipv4 or 'ipv6 addresses. The #:type argument may be used to filter for 'tcp / 'stream, 'udp / 'datagram or 'raw socket types.

Unless the #:numeric? flag is set to a true value, the procedure will convert hostnames into numeric network addresses.