Next: posix socket protocols, Previous: posix socket addresses, Up: posix socket [Index]
Data structure type used to represent at the Scheme level struct
hostent
values. It has the following fields:
h_name
Bytevector, the official host name.
h_aliases
List of bytevectors, host name aliases.
h_addrtype
Fixnum, AF_INET
or AF_INET6
.
h_length
Fixnum, number of bytes in each host address bytevector.
h_addr_list
List of bytevectors each holding struct in_addr
or struct
in6_addr
.
h_addr
Bytevector, it is the first in the list h_addr_list
.
Build and return an instance of struct-hostent
.
Return #t
if obj is an instance of struct-hostent
,
otherwise return #f
.
Accessors for the fields of struct-hostent
instances.
Interface to the C function gethostbyname()
, (libc)gethostbyname. Given the string or bytevector hostname holding
the ASCII representation of a host name, build and return an instance
of struct-hostent
. If an error occurs, return an encoded
h_errno
value.
(import (vicare) (prefix (vicare posix) px.)) (px.gethostbyname "github.com") ⇒ #["struct-hostent" h_name="github.com" h_aliases=() h_addrtype=AF_INET h_length=4 h_addr_list=(#vu8(207 97 227 239)) h_addr=#vu8(207 97 227 239)] (px.gethostbyname "google.com") ⇒ #["struct-hostent" h_name="google.com" h_aliases=() h_addrtype=AF_INET h_length=4 h_addr_list=(#vu8(209 85 148 103) #vu8(209 85 148 99) #vu8(209 85 148 104) #vu8(209 85 148 105) #vu8(209 85 148 106) #vu8(209 85 148 147)) h_addr=#vu8(209 85 148 103)]
Interface to the C function gethostbyaddr()
, (libc)gethostbyaddr. Given the bytevector addr holding a struct
in_addr
or a struct in6_addr
, build and return an instance of
struct-hostent
; the type of address is automatically inferred
from the length of the bytevector. If an error occurs: an exception is
raised.
Interface to the C functions sethostent()
, gethostent()
and
endhostent()
, (libc)gethostbyaddr. Build and
return a list of struct-hostent
representing the entries in the
hosts database.
Next: posix socket protocols, Previous: posix socket addresses, Up: posix socket [Index]