diff options
| author | Richard M. Stallman | 2005-08-11 19:46:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-08-11 19:46:35 +0000 |
| commit | 088767cbda69d1d0d52297fafe145c36d8b006a2 (patch) | |
| tree | d83f61350a17924140f438c61bf861c244f4de2a /lispref | |
| parent | 6e2d14c82468c52831d2d6c513d6bd4ef6afc406 (diff) | |
| download | emacs-088767cbda69d1d0d52297fafe145c36d8b006a2.tar.gz emacs-088767cbda69d1d0d52297fafe145c36d8b006a2.zip | |
(Misc Network, Network Feature Testing)
(Network Options, Make Network): New nodes split out of Low-Level Network.
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/processes.texi | 126 |
1 files changed, 76 insertions, 50 deletions
diff --git a/lispref/processes.texi b/lispref/processes.texi index bf92fc387a7..afdeaa1d2a0 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi | |||
| @@ -52,6 +52,7 @@ This function returns @code{t} if @var{object} is a process, | |||
| 52 | * Datagrams:: UDP network connections. | 52 | * Datagrams:: UDP network connections. |
| 53 | * Low-Level Network:: Lower-level but more general function | 53 | * Low-Level Network:: Lower-level but more general function |
| 54 | to create connections and servers. | 54 | to create connections and servers. |
| 55 | * Misc Network:: Additional relevant functions for network connections. | ||
| 55 | * Byte Packing:: Using bindat to pack and unpack binary data. | 56 | * Byte Packing:: Using bindat to pack and unpack binary data. |
| 56 | @end menu | 57 | @end menu |
| 57 | 58 | ||
| @@ -1716,6 +1717,20 @@ sets its remote peer address to @var{address}. | |||
| 1716 | @node Low-Level Network | 1717 | @node Low-Level Network |
| 1717 | @section Low-Level Network Access | 1718 | @section Low-Level Network Access |
| 1718 | 1719 | ||
| 1720 | You can also create network connections by operating at a lower | ||
| 1721 | level that that of @code{open-network-stream}, using | ||
| 1722 | @code{make-network-process}. | ||
| 1723 | |||
| 1724 | @menu | ||
| 1725 | * Make Network:: Using @code{make-network-process}. | ||
| 1726 | * Network Options:: Further control over network connections. | ||
| 1727 | * Network Feature Testing:: Determining which network features work on | ||
| 1728 | the machine you are using. | ||
| 1729 | @end menu | ||
| 1730 | |||
| 1731 | @node Make Network | ||
| 1732 | @subsection @code{make-network-process} | ||
| 1733 | |||
| 1719 | The basic function for creating network connections and network | 1734 | The basic function for creating network connections and network |
| 1720 | servers is @code{make-network-process}. It can do either of those | 1735 | servers is @code{make-network-process}. It can do either of those |
| 1721 | jobs, depending on the arguments you give it. | 1736 | jobs, depending on the arguments you give it. |
| @@ -1852,14 +1867,21 @@ happened. | |||
| 1852 | Initialize the process plist to @var{plist}. | 1867 | Initialize the process plist to @var{plist}. |
| 1853 | @end table | 1868 | @end table |
| 1854 | 1869 | ||
| 1855 | The following network options can be specified for the network | 1870 | The original argument list, modified with the actual connection |
| 1856 | process. Except for @code{:reuseaddr}, you can set or modify these | 1871 | information, is available via the @code{process-contact} function. |
| 1857 | options later using @code{set-network-process-option}. | 1872 | @end defun |
| 1873 | |||
| 1874 | @node Network Options | ||
| 1875 | @subsection Network Options | ||
| 1858 | 1876 | ||
| 1859 | For a server process, the options specified with | 1877 | The following network options can be specified when you create a |
| 1878 | network process. Except for @code{:reuseaddr}, you can also set or | ||
| 1879 | modify these options later, using @code{set-network-process-option}. | ||
| 1880 | |||
| 1881 | For a server process, the options specified with | ||
| 1860 | @code{make-network-process} are not inherited by the client | 1882 | @code{make-network-process} are not inherited by the client |
| 1861 | connections, so you will need to set the necessary options for each | 1883 | connections, so you will need to set the necessary options for each |
| 1862 | child connection as they are created. | 1884 | child connection as it is created. |
| 1863 | 1885 | ||
| 1864 | @table @asis | 1886 | @table @asis |
| 1865 | @item :bindtodevice @var{device-name} | 1887 | @item :bindtodevice @var{device-name} |
| @@ -1914,13 +1936,8 @@ listening on that port. If @var{reuseaddr-flag} is @code{nil}, there | |||
| 1914 | may be a period of time after the last use of that port (by any | 1936 | may be a period of time after the last use of that port (by any |
| 1915 | process on the host), where it is not possible to make a new server on | 1937 | process on the host), where it is not possible to make a new server on |
| 1916 | that port. | 1938 | that port. |
| 1917 | |||
| 1918 | @end table | 1939 | @end table |
| 1919 | 1940 | ||
| 1920 | The original argument list, modified with the actual connection | ||
| 1921 | information, is available via the @code{process-contact} function. | ||
| 1922 | @end defun | ||
| 1923 | |||
| 1924 | @defun set-network-process-option process option value | 1941 | @defun set-network-process-option process option value |
| 1925 | This function sets or modifies a network option for network process | 1942 | This function sets or modifies a network option for network process |
| 1926 | @var{process}. See @code{make-network-process} for details of options | 1943 | @var{process}. See @code{make-network-process} for details of options |
| @@ -1930,44 +1947,8 @@ The current setting of an option is available via the | |||
| 1930 | @code{process-contact} function. | 1947 | @code{process-contact} function. |
| 1931 | @end defun | 1948 | @end defun |
| 1932 | 1949 | ||
| 1933 | @defun network-interface-list | 1950 | @node Network Feature Testing |
| 1934 | This function returns a list describing the network interfaces | 1951 | @subsection Testing Availability of Network Features |
| 1935 | of the machine you are using. The value is an alist whose | ||
| 1936 | elements have the form @code{(@var{name} . @var{address})}. | ||
| 1937 | @var{address} has the same form as the @var{local-address} | ||
| 1938 | and @var{remote-address} arguments to @code{make-network-process}. | ||
| 1939 | @end defun | ||
| 1940 | |||
| 1941 | @defun network-interface-info ifname | ||
| 1942 | This function returns information about the network interface named | ||
| 1943 | @var{ifname}. The value is a list of the form | ||
| 1944 | @code{(@var{addr} @var{bcast} @var{netmask} @var{hwaddr} @var{flags})}. | ||
| 1945 | |||
| 1946 | @table @var | ||
| 1947 | @item addr | ||
| 1948 | The internet protocol address. | ||
| 1949 | @item bcast | ||
| 1950 | The broadcast address. | ||
| 1951 | @item netmask | ||
| 1952 | The network mask. | ||
| 1953 | @item hwaddr | ||
| 1954 | The layer 2 address (Ethernet MAC address, for instance). | ||
| 1955 | @item flags | ||
| 1956 | The current flags of the interface. | ||
| 1957 | @end table | ||
| 1958 | @end defun | ||
| 1959 | |||
| 1960 | @defun format-network-address address &optional omit-port | ||
| 1961 | This function converts the Lisp representation of a network address to | ||
| 1962 | a string. For example, a five-element vector @code{[@var{a} @var{b} | ||
| 1963 | @var{c} @var{d} @var{p}]} represents an IP address | ||
| 1964 | @var{a}.@var{b}.@var{c}.@var{d} and port number @var{p}. | ||
| 1965 | @code{format-network-address} converts that to the string | ||
| 1966 | @code{"@var{a}.@var{b}.@var{c}.@var{d}:@var{p}"}. | ||
| 1967 | |||
| 1968 | If @var{omit-port} is non-@code{nil}, the value does not include | ||
| 1969 | the port number. | ||
| 1970 | @end defun | ||
| 1971 | 1952 | ||
| 1972 | To test for the availability of a given network feature, use | 1953 | To test for the availability of a given network feature, use |
| 1973 | @code{featurep} like this: | 1954 | @code{featurep} like this: |
| @@ -2002,8 +1983,8 @@ Non-@code{nil} if the system can select the port for a server. | |||
| 2002 | (featurep 'make-network-process '@var{keyword}) | 1983 | (featurep 'make-network-process '@var{keyword}) |
| 2003 | @end example | 1984 | @end example |
| 2004 | 1985 | ||
| 2005 | Here are some of the option @var{keyword}s you can test in | 1986 | @noindent |
| 2006 | this way. | 1987 | Here are some of the options you can test in this way. |
| 2007 | 1988 | ||
| 2008 | @table @code | 1989 | @table @code |
| 2009 | @item :bindtodevice | 1990 | @item :bindtodevice |
| @@ -2018,6 +1999,51 @@ That particular network option is supported by | |||
| 2018 | @code{make-network-process} and @code{set-network-process-option}. | 1999 | @code{make-network-process} and @code{set-network-process-option}. |
| 2019 | @end table | 2000 | @end table |
| 2020 | 2001 | ||
| 2002 | @node Misc Network | ||
| 2003 | @section Misc Network Facilities | ||
| 2004 | |||
| 2005 | These additional functions are useful for creating and operating | ||
| 2006 | on network connections. | ||
| 2007 | |||
| 2008 | @defun network-interface-list | ||
| 2009 | This function returns a list describing the network interfaces | ||
| 2010 | of the machine you are using. The value is an alist whose | ||
| 2011 | elements have the form @code{(@var{name} . @var{address})}. | ||
| 2012 | @var{address} has the same form as the @var{local-address} | ||
| 2013 | and @var{remote-address} arguments to @code{make-network-process}. | ||
| 2014 | @end defun | ||
| 2015 | |||
| 2016 | @defun network-interface-info ifname | ||
| 2017 | This function returns information about the network interface named | ||
| 2018 | @var{ifname}. The value is a list of the form | ||
| 2019 | @code{(@var{addr} @var{bcast} @var{netmask} @var{hwaddr} @var{flags})}. | ||
| 2020 | |||
| 2021 | @table @var | ||
| 2022 | @item addr | ||
| 2023 | The internet protocol address. | ||
| 2024 | @item bcast | ||
| 2025 | The broadcast address. | ||
| 2026 | @item netmask | ||
| 2027 | The network mask. | ||
| 2028 | @item hwaddr | ||
| 2029 | The layer 2 address (Ethernet MAC address, for instance). | ||
| 2030 | @item flags | ||
| 2031 | The current flags of the interface. | ||
| 2032 | @end table | ||
| 2033 | @end defun | ||
| 2034 | |||
| 2035 | @defun format-network-address address &optional omit-port | ||
| 2036 | This function converts the Lisp representation of a network address to | ||
| 2037 | a string. For example, a five-element vector @code{[@var{a} @var{b} | ||
| 2038 | @var{c} @var{d} @var{p}]} represents an IP address | ||
| 2039 | @var{a}.@var{b}.@var{c}.@var{d} and port number @var{p}. | ||
| 2040 | @code{format-network-address} converts that to the string | ||
| 2041 | @code{"@var{a}.@var{b}.@var{c}.@var{d}:@var{p}"}. | ||
| 2042 | |||
| 2043 | If @var{omit-port} is non-@code{nil}, the value does not include | ||
| 2044 | the port number. | ||
| 2045 | @end defun | ||
| 2046 | |||
| 2021 | @node Byte Packing | 2047 | @node Byte Packing |
| 2022 | @section Packing and Unpacking Byte Arrays | 2048 | @section Packing and Unpacking Byte Arrays |
| 2023 | 2049 | ||