elisp: Misc Network
36.18 Misc Network Facilities
=============================
These additional functions are useful for creating and operating on
network connections. Note that they are supported only on some systems.
-- Function: network-interface-list
This function returns a list describing the network interfaces of
the machine you are using. The value is an alist whose elements
have the form ‘(NAME . ADDRESS)’. ADDRESS has the same form as the
LOCAL-ADDRESS and REMOTE-ADDRESS arguments to
‘make-network-process’.
-- Function: network-interface-info ifname
This function returns information about the network interface named
IFNAME. The value is a list of the form ‘(ADDR BCAST NETMASK
HWADDR FLAGS)’.
ADDR
The Internet protocol address.
BCAST
The broadcast address.
NETMASK
The network mask.
HWADDR
The layer 2 address (Ethernet MAC address, for instance).
FLAGS
The current flags of the interface.
-- Function: format-network-address address &optional omit-port
This function converts the Lisp representation of a network address
to a string.
A five-element vector ‘[A B C D P]’ represents an IPv4 address
A.B.C.D and port number P. ‘format-network-address’ converts that
to the string ‘"A.B.C.D:P"’.
A nine-element vector ‘[A B C D E F G H P]’ represents an IPv6
address along with a port number. ‘format-network-address’
converts that to the string ‘"[A:B:C:D:E:F:G:H]:P"’.
If the vector does not include the port number, P, or if OMIT-PORT
is non-‘nil’, the result does not include the ‘:P’ suffix.