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_nameBytevector, the official host name.
h_aliasesList of bytevectors, host name aliases.
h_addrtypeFixnum, AF_INET or AF_INET6.
h_lengthFixnum, number of bytes in each host address bytevector.
h_addr_listList of bytevectors each holding struct in_addr or struct
in6_addr.
h_addrBytevector, 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]