aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2003-09-23 22:05:38 +0000
committerKim F. Storm2003-09-23 22:05:38 +0000
commit0bbffed703731f8ded124f0c405633d0ad95d16e (patch)
treefdc692a93b1bd88702ae265631f983a06ae54737
parentef6ae4ff6d9d0aa909554a654cecbf38334115a4 (diff)
downloademacs-0bbffed703731f8ded124f0c405633d0ad95d16e.tar.gz
emacs-0bbffed703731f8ded124f0c405633d0ad95d16e.zip
(Network, Network Servers): Fix typos.
(Low-Level Network): Add timeout value for :server keyword. Add new option keywords to make-network-process. Add set-network-process-options. Explain how to test availability of network options.
-rw-r--r--lispref/processes.texi157
1 files changed, 124 insertions, 33 deletions
diff --git a/lispref/processes.texi b/lispref/processes.texi
index ab63d414471..4887b880abb 100644
--- a/lispref/processes.texi
+++ b/lispref/processes.texi
@@ -1473,10 +1473,11 @@ Transaction queues are implemented by means of a filter function.
1473@section Network Connections 1473@section Network Connections
1474@cindex network connection 1474@cindex network connection
1475@cindex TCP 1475@cindex TCP
1476@cindex UDP
1476 1477
1477 Emacs Lisp programs can open TCP and datagram network connections to 1478 Emacs Lisp programs can open stream (TCP) and datagram (UDP) network
1478other processes on the same machine or other machines. A network 1479connections to other processes on the same machine or other machines.
1479connection is handled by Lisp much like a subprocess, and is 1480A network connection is handled by Lisp much like a subprocess, and is
1480represented by a process object. However, the process you are 1481represented by a process object. However, the process you are
1481communicating with is not a child of the Emacs process, so it has no 1482communicating with is not a child of the Emacs process, so it has no
1482process @sc{id}, and you can't kill it or send it signals. All you 1483process @sc{id}, and you can't kill it or send it signals. All you
@@ -1504,12 +1505,13 @@ subprocess. @xref{Process Information}.
1504 You can stop and resume operation of a network processes by calling 1505 You can stop and resume operation of a network processes by calling
1505@code{stop-process} and @code{continue-process}. For a server 1506@code{stop-process} and @code{continue-process}. For a server
1506process, being stopped means not accepting new connections. (Up to 5 1507process, being stopped means not accepting new connections. (Up to 5
1507connection requests will be queued for when you resume the server; 1508connection requests will be queued for when you resume the server; you
1508this limit is imposed by the operating system.) For a network 1509can increase this limit, unless it is imposed by the operating
1509connection, being stopped means not processing input (any arriving 1510systems.) For a network connection, being stopped means not
1510input waits until you resume the connection). You can use the 1511processing input (any arriving input waits until you resume the
1511function @code{process-command} to determine whether a network 1512connection). You can use the function @code{process-command} to
1512connection or server is stopped; a non-@code{nil} value means yes. 1513determine whether a network connection or server is stopped; a
1514non-@code{nil} value means yes.
1513 1515
1514@defun open-network-stream name buffer-or-name host service 1516@defun open-network-stream name buffer-or-name host service
1515This function opens a TCP connection, and returns a process object 1517This function opens a TCP connection, and returns a process object
@@ -1565,7 +1567,7 @@ The associated value is the process buffer.
1565@item :filter 1567@item :filter
1566The associated value is the process filter function. 1568The associated value is the process filter function.
1567@item :sentinel 1569@item :sentinel
1568The associated value is the process filter function. 1570The associated value is the process sentinel function.
1569@item :remote 1571@item :remote
1570In a connection, this is the address in internal format of the remote peer. 1572In a connection, this is the address in internal format of the remote peer.
1571@item :local 1573@item :local
@@ -1599,12 +1601,12 @@ The connection's process name is constructed by concatenating the
1599server process' @var{name} with a client identification string. The 1601server process' @var{name} with a client identification string. The
1600client identification string for an IPv4 connection looks like 1602client identification string for an IPv4 connection looks like
1601@samp{<@var{a}.@var{b}.@var{c}.@var{d}:@var{p}>}. Otherwise, it is a 1603@samp{<@var{a}.@var{b}.@var{c}.@var{d}:@var{p}>}. Otherwise, it is a
1602unique number in brackets, as in @samp{<@var{nnn>}}. The number 1604unique number in brackets, as in @samp{<@var{nnn}>}. The number
1603is unique for each connection in the Emacs session. 1605is unique for each connection in the Emacs session.
1604 1606
1605@item 1607@item
1606If the server's filter is non-@code{nil}, the connection process does 1608If the server's filter is non-@code{nil}, the connection process does
1607not get a separate process buffer; otherwise, Emacs creates a bew 1609not get a separate process buffer; otherwise, Emacs creates a new
1608buffer for the purpose. The buffer name is the server's buffer name 1610buffer for the purpose. The buffer name is the server's buffer name
1609or process name, concatenated with the client identification string. 1611or process name, concatenated with the client identification string.
1610 1612
@@ -1691,8 +1693,8 @@ This function creates a network connection or server and returns the
1691process object that represents it. The arguments @var{args} are a 1693process object that represents it. The arguments @var{args} are a
1692list of keyword/argument pairs. Omitting a keyword is always 1694list of keyword/argument pairs. Omitting a keyword is always
1693equivalent to specifying it with value @code{nil}, except for 1695equivalent to specifying it with value @code{nil}, except for
1694@code{:coding} and @code{:filter-multibyte}. Here are the meaningful 1696@code{:coding}, @code{:filter-multibyte}, and @code{:reuseaddr}. Here
1695keywords: 1697are the meaningful keywords:
1696 1698
1697@table @asis 1699@table @asis
1698@item :name name 1700@item :name name
@@ -1706,7 +1708,9 @@ connection. Both connections and servers can be of either type.
1706 1708
1707@item :server @var{server-flag} 1709@item :server @var{server-flag}
1708If @var{server-flag} is non-@code{nil}, create a server. Otherwise, 1710If @var{server-flag} is non-@code{nil}, create a server. Otherwise,
1709create a connection. 1711create a connection. For a stream type server, @var{server-flag} may
1712be an integer which then specifies the length of the queue of pending
1713connections to the server. The default queue length is 5.
1710 1714
1711@item :host @var{host} 1715@item :host @var{host}
1712Specify the host to connect to. @var{host} should be a host name or 1716Specify the host to connect to. @var{host} should be a host name or
@@ -1785,14 +1789,10 @@ encoding data sent to it, specify @code{(@var{decoding} .
1785@var{encoding})} for @var{coding}. 1789@var{encoding})} for @var{coding}.
1786 1790
1787If you don't specify this keyword at all, the default 1791If you don't specify this keyword at all, the default
1788is to determine the coding systemx from the data. 1792is to determine the coding systems from the data.
1789
1790@item :options @var{options}
1791Set the specified options for the network process. See
1792@code{set-network-process-options} for details.
1793 1793
1794@item :noquery @var{query-flag} 1794@item :noquery @var{query-flag}
1795Initialize the process query flag to @var{query-flag}. 1795Initialize the process query flag to @var{query-flag}. @xref{Query Before Exit}.
1796 1796
1797@item :filter @var{filter} 1797@item :filter @var{filter}
1798Initialize the process filter to @var{filter}. 1798Initialize the process filter to @var{filter}.
@@ -1819,10 +1819,84 @@ happened.
1819Initialize the process plist to @var{plist}. 1819Initialize the process plist to @var{plist}.
1820@end table 1820@end table
1821 1821
1822The following network options can be specified for the network
1823process. Except for @code{:reuseaddr}, you can set or modify these
1824options later using @code{set-network-process-option}.
1825
1826For a server process, the options specified with
1827@code{make-network-process} are not inherited by the client
1828connections, so you will need to set the necessary options for each
1829child connection as they are created.
1830
1831@table asis
1832@item :bindtodevice @var{device-name}
1833If @var{device-name} is a non-empty string identifying a network
1834interface name (see @code{network-interface-list}), only handle
1835packets received on that interface. If @var{device-name} is nil (the
1836default), handle packets received on any interface.
1837
1838Using this option may require special privileges on some systems.
1839
1840@item :broadcast @var{broadcast-flag}
1841If @var{broadcast-flag} is non-@code{nil} for a datagram process, the
1842process will receive datagram packet sent to a broadcast address, and
1843be able to send packets to a broadcast address. Ignored for a stream
1844connection.
1845
1846@item :dontroute @var{dontroute-flag}
1847If @var{dontroute-flag} is non-@code{nil}, the process can only send
1848to hosts on the same network as the local host.
1849
1850@item :keepalive @var{keepalive-flag}
1851If @var{keepalive-flag} is non-@code{nil} for a stream connection,
1852enable exchange of low-level keep-alive messa
1853
1854@item :linger @var{linger-arg}
1855If @var{linger-arg} is non-@code{nil}, wait for successful
1856transmission of all queued packets on the connection before it is
1857deleted (see @code{delete-process}). If @var{linger-arg} is an
1858integer, it specifies the maximum time in seconds to wait for queued
1859packets to be sent before closing the connection. Default is
1860@code{nil} which means to discard unsent queued packets when the
1861process is deleted.
1862
1863@item :oobinline @var{oobinline-flag}
1864If @var{oobinline-flag} is non-@code{nil} for a stream connection,
1865receive out-of-band data in the normal data stream. Otherwise, ignore
1866out-of-band data.
1867
1868@item :priority @var{priority}
1869Set the priority for packets sent on this connection to the integer
1870@var{priority}. The interpretation of this number is protocol
1871specific, such as setting the TOS (type of service) field on IP
1872packets sent on this connection. It may also have system dependent
1873effects, such as selecting a specific output queue on the network
1874interface.
1875
1876@item :reuseaddr @var{reuseaddr-flag}
1877If @var{reuseaddr-flag} is non-@code{nil} (the default) for a stream
1878server process, allow this server to reuse a specific port number (see
1879@code{:service}) unless another process on this host is already
1880listening on that port. If @var{reuseaddr-flag} is @code{nil}, there
1881may be a period of time after the last use of that port (by any
1882process on the host), where it is not possible to make a new server on
1883that port.
1884
1885@end table
1886
1822The original argument list, modified with the actual connection 1887The original argument list, modified with the actual connection
1823information, is available via the `process-contact' function. 1888information, is available via the `process-contact' function.
1824@end defun 1889@end defun
1825 1890
1891@defun set-network-process-option process option value
1892This function sets or modifies a network option for network process
1893@var{process}. See @code{make-network-process} for details of options
1894@var{option} and their corresponding values @var{value}.
1895
1896The current setting of an option is available via the
1897`process-contact' function.
1898@end defun
1899
1826@defun network-interface-list 1900@defun network-interface-list
1827This function returns a list describing the network interfaces 1901This function returns a list describing the network interfaces
1828of the machine you are using. The value is an alist whose 1902of the machine you are using. The value is an alist whose
@@ -1869,9 +1943,12 @@ the port number.
1869@end example 1943@end example
1870 1944
1871@noindent 1945@noindent
1872The result is @code{t} if it works to specify @var{keyword} with value 1946The result of the first form is @code{t} if it works to specify
1873@var{value} in @code{make-network-process}. Here are some of the 1947@var{keyword} with value @var{value} in @code{make-network-process}.
1874@var{keyword}---@var{value} pairs you can test in this way. 1948The result of the second form is @code{t} if @var{keyword} is
1949supported by @code{make-network-process}. Here are some of the
1950@var{keyword}---@var{value} pairs you can test in
1951this way.
1875 1952
1876@table @code 1953@table @code
1877@item (:nowait t) 1954@item (:nowait t)
@@ -1882,15 +1959,29 @@ Non-@code{nil} if datagrams are supported.
1882Non-@code{nil} if local (aka ``UNIX domain'') sockets are supported. 1959Non-@code{nil} if local (aka ``UNIX domain'') sockets are supported.
1883@item (:service t) 1960@item (:service t)
1884Non-@code{nil} if the system can select the port for a server. 1961Non-@code{nil} if the system can select the port for a server.
1885@item (:options bindtodevice) 1962@end table
1886@itemx (:options broadcast) 1963
1887@itemx (:options dontroute) 1964 To test for the availability of a given network option, use
1888@itemx (:options keepalive) 1965@code{featurep} like this:
1889@itemx (:options linger) 1966
1890@itemx (:options oobinline) 1967@example
1891@itemx (:options priority) 1968(featurep 'make-network-process '@var{keyword})
1892@itemx (:options reuseaddr) 1969@end example
1893That particular socket option is supported. 1970
1971Here are some of the option @var{keyword}s you can test in
1972this way.
1973
1974@table @code
1975@item :bindtodevice
1976@itemx :broadcast
1977@itemx :dontroute
1978@itemx :keepalive
1979@itemx :linger
1980@itemx :oobinline
1981@itemx :priority
1982@itemx :reuseaddr
1983That particular network option is supported by
1984@code{make-network-process} and @code{set-network-process-option}.
1894@end table 1985@end table
1895 1986
1896@ignore 1987@ignore