6.4 Socket addresses (families)
The library supports both IP4 and IP6 addresses. On Unix systems it
also supports Unix domain sockets (AF_UNIX
). The
address of a Unix domain sockets is a file name. Unix domain sockets are
created using
socket_create/2 or unix_domain_socket/1.
IP4 or IP6 sockets can be created using socket_create/2
or tcp_connect/3 with the inet
(default, IP3) or inet6
domain option. Some of the
predicates produce or consume IP addresses as a Prolog term. The format
of this term is one of:
- ip(A, B, C, D)
- Represents an IP4 address. Each field is an integer in the range 0..255 (8 bit).
- ip(A, B, C, D, E, F, G, H)
- Represents an IP6 address. Each field is an integer in the range 0..65535 (16 bit).
The predicate ip_name/2 translates between the canonical textual representation and the above defined address terms.