Mercurial > emacs
comparison lispref/processes.texi @ 64913:989a5fc8da03
(Misc Network, Network Feature Testing)
(Network Options, Make Network): New nodes split out of Low-Level Network.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 11 Aug 2005 19:46:35 +0000 |
parents | e836425ee789 |
children | 6677034b52bb 2d92f5c9d6ae |
comparison
equal
deleted
inserted
replaced
64912:cf610b797357 | 64913:989a5fc8da03 |
---|---|
50 * Network:: Opening network connections. | 50 * Network:: Opening network connections. |
51 * Network Servers:: Network servers let Emacs accept net connections. | 51 * Network Servers:: Network servers let Emacs accept net connections. |
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 |
58 @node Subprocess Creation | 59 @node Subprocess Creation |
59 @section Functions that Create Subprocesses | 60 @section Functions that Create Subprocesses |
1714 @end defun | 1715 @end defun |
1715 | 1716 |
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. |
1722 | 1737 |
1723 @defun make-network-process &rest args | 1738 @defun make-network-process &rest args |
1850 | 1865 |
1851 @item :plist @var{plist} | 1866 @item :plist @var{plist} |
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 |
1858 | 1873 |
1859 For a server process, the options specified with | 1874 @node Network Options |
1875 @subsection Network Options | |
1876 | |
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} |
1866 If @var{device-name} is a non-empty string identifying a network | 1888 If @var{device-name} is a non-empty string identifying a network |
1867 interface name (see @code{network-interface-list}), only handle | 1889 interface name (see @code{network-interface-list}), only handle |
1912 @code{:service}) unless another process on this host is already | 1934 @code{:service}) unless another process on this host is already |
1913 listening on that port. If @var{reuseaddr-flag} is @code{nil}, there | 1935 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 | |
1920 The original argument list, modified with the actual connection | |
1921 information, is available via the @code{process-contact} function. | |
1922 @end defun | |
1923 | 1940 |
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 |
1927 @var{option} and their corresponding values @var{value}. | 1944 @var{option} and their corresponding values @var{value}. |
1928 | 1945 |
1929 The current setting of an option is available via the | 1946 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 |
1949 | |
1950 @node Network Feature Testing | |
1951 @subsection Testing Availability of Network Features | |
1952 | |
1953 To test for the availability of a given network feature, use | |
1954 @code{featurep} like this: | |
1955 | |
1956 @example | |
1957 (featurep 'make-network-process '(@var{keyword} @var{value})) | |
1958 @end example | |
1959 | |
1960 @noindent | |
1961 The result of the first form is @code{t} if it works to specify | |
1962 @var{keyword} with value @var{value} in @code{make-network-process}. | |
1963 The result of the second form is @code{t} if @var{keyword} is | |
1964 supported by @code{make-network-process}. Here are some of the | |
1965 @var{keyword}---@var{value} pairs you can test in | |
1966 this way. | |
1967 | |
1968 @table @code | |
1969 @item (:nowait t) | |
1970 Non-@code{nil} if non-blocking connect is supported. | |
1971 @item (:type datagram) | |
1972 Non-@code{nil} if datagrams are supported. | |
1973 @item (:family local) | |
1974 Non-@code{nil} if local (aka ``UNIX domain'') sockets are supported. | |
1975 @item (:service t) | |
1976 Non-@code{nil} if the system can select the port for a server. | |
1977 @end table | |
1978 | |
1979 To test for the availability of a given network option, use | |
1980 @code{featurep} like this: | |
1981 | |
1982 @example | |
1983 (featurep 'make-network-process '@var{keyword}) | |
1984 @end example | |
1985 | |
1986 @noindent | |
1987 Here are some of the options you can test in this way. | |
1988 | |
1989 @table @code | |
1990 @item :bindtodevice | |
1991 @itemx :broadcast | |
1992 @itemx :dontroute | |
1993 @itemx :keepalive | |
1994 @itemx :linger | |
1995 @itemx :oobinline | |
1996 @itemx :priority | |
1997 @itemx :reuseaddr | |
1998 That particular network option is supported by | |
1999 @code{make-network-process} and @code{set-network-process-option}. | |
2000 @end table | |
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. | |
1932 | 2007 |
1933 @defun network-interface-list | 2008 @defun network-interface-list |
1934 This function returns a list describing the network interfaces | 2009 This function returns a list describing the network interfaces |
1935 of the machine you are using. The value is an alist whose | 2010 of the machine you are using. The value is an alist whose |
1936 elements have the form @code{(@var{name} . @var{address})}. | 2011 elements have the form @code{(@var{name} . @var{address})}. |
1966 @code{"@var{a}.@var{b}.@var{c}.@var{d}:@var{p}"}. | 2041 @code{"@var{a}.@var{b}.@var{c}.@var{d}:@var{p}"}. |
1967 | 2042 |
1968 If @var{omit-port} is non-@code{nil}, the value does not include | 2043 If @var{omit-port} is non-@code{nil}, the value does not include |
1969 the port number. | 2044 the port number. |
1970 @end defun | 2045 @end defun |
1971 | |
1972 To test for the availability of a given network feature, use | |
1973 @code{featurep} like this: | |
1974 | |
1975 @example | |
1976 (featurep 'make-network-process '(@var{keyword} @var{value})) | |
1977 @end example | |
1978 | |
1979 @noindent | |
1980 The result of the first form is @code{t} if it works to specify | |
1981 @var{keyword} with value @var{value} in @code{make-network-process}. | |
1982 The result of the second form is @code{t} if @var{keyword} is | |
1983 supported by @code{make-network-process}. Here are some of the | |
1984 @var{keyword}---@var{value} pairs you can test in | |
1985 this way. | |
1986 | |
1987 @table @code | |
1988 @item (:nowait t) | |
1989 Non-@code{nil} if non-blocking connect is supported. | |
1990 @item (:type datagram) | |
1991 Non-@code{nil} if datagrams are supported. | |
1992 @item (:family local) | |
1993 Non-@code{nil} if local (aka ``UNIX domain'') sockets are supported. | |
1994 @item (:service t) | |
1995 Non-@code{nil} if the system can select the port for a server. | |
1996 @end table | |
1997 | |
1998 To test for the availability of a given network option, use | |
1999 @code{featurep} like this: | |
2000 | |
2001 @example | |
2002 (featurep 'make-network-process '@var{keyword}) | |
2003 @end example | |
2004 | |
2005 Here are some of the option @var{keyword}s you can test in | |
2006 this way. | |
2007 | |
2008 @table @code | |
2009 @item :bindtodevice | |
2010 @itemx :broadcast | |
2011 @itemx :dontroute | |
2012 @itemx :keepalive | |
2013 @itemx :linger | |
2014 @itemx :oobinline | |
2015 @itemx :priority | |
2016 @itemx :reuseaddr | |
2017 That particular network option is supported by | |
2018 @code{make-network-process} and @code{set-network-process-option}. | |
2019 @end table | |
2020 | 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 |
2024 This section describes how to pack and unpack arrays of bytes, | 2050 This section describes how to pack and unpack arrays of bytes, |