Next: , Previous: , Up: posix socket   [Index]


4.15.7 Error and miscellaneous functions

Function: h_errno->string h_errno-code

Convert an encoded h_errno value to the corresponding symbolic string.

Function: h_strerror h_errno-code

Convert an encoded h_errno value to the corresponding descriptive error message string.

Function: gai-strerror error-code

Interface to the C function gai_strerror(), see the manual page gai_strerror(3). Convert an EAI_ error code into the corresponding error message, return a string holding such message.

Function: htonl host-long
Function: ntohl net-long

Convert an exact integer, in the range of the C language type uint32_t, between host byte order and network byte order; (libc)ntohl.

On the i386 platform: host byte order is least significant byte first. The network byte order is: most significant byte first.

#!r6rs
(import (vicare)
  (prefix (vicare posix) px.))

(px.htonl #xA5B6C7D8)                   ⇒ #xD8C7B6A5
(px.ntohl #xA5B6C7D8)                   ⇒ #xD8C7B6A5
(px.ntohl (px.htonl #xA5B6C7D8))        ⇒ #xA5B6C7D8
Function: htons host-short
Function: ntohs net-short

Convert an exact integer, in the range of the C language type uint16_t, between host byte order and network byte order; (libc)htons.

On the i386 platform: host byte order is least significant byte first. The network byte order is: most significant byte first.

#!r6rs
(import (vicare)
  (prefix (vicare posix) px.))

(px.htons #xA5B6)               ⇒ #xB6A5
(px.ntohs #xA5B6)               ⇒ #xB6A5
(px.ntohs (px.htons #xA5B6))    ⇒ #xA5B6