aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorRichard M. Stallman2005-08-11 19:46:35 +0000
committerRichard M. Stallman2005-08-11 19:46:35 +0000
commit088767cbda69d1d0d52297fafe145c36d8b006a2 (patch)
treed83f61350a17924140f438c61bf861c244f4de2a /lispref
parent6e2d14c82468c52831d2d6c513d6bd4ef6afc406 (diff)
downloademacs-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.texi126
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
1721level 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
1720servers is @code{make-network-process}. It can do either of those 1735servers is @code{make-network-process}. It can do either of those
1721jobs, depending on the arguments you give it. 1736jobs, depending on the arguments you give it.
@@ -1852,14 +1867,21 @@ happened.
1852Initialize the process plist to @var{plist}. 1867Initialize the process plist to @var{plist}.
1853@end table 1868@end table
1854 1869
1855The following network options can be specified for the network 1870The original argument list, modified with the actual connection
1856process. Except for @code{:reuseaddr}, you can set or modify these 1871information, is available via the @code{process-contact} function.
1857options later using @code{set-network-process-option}. 1872@end defun
1873
1874@node Network Options
1875@subsection Network Options
1858 1876
1859For a server process, the options specified with 1877 The following network options can be specified when you create a
1878network process. Except for @code{:reuseaddr}, you can also set or
1879modify 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
1861connections, so you will need to set the necessary options for each 1883connections, so you will need to set the necessary options for each
1862child connection as they are created. 1884child 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
1914may be a period of time after the last use of that port (by any 1936may be a period of time after the last use of that port (by any
1915process on the host), where it is not possible to make a new server on 1937process on the host), where it is not possible to make a new server on
1916that port. 1938that port.
1917
1918@end table 1939@end table
1919 1940
1920The original argument list, modified with the actual connection
1921information, 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
1925This function sets or modifies a network option for network process 1942This 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
1934This function returns a list describing the network interfaces 1951@subsection Testing Availability of Network Features
1935of the machine you are using. The value is an alist whose
1936elements have the form @code{(@var{name} . @var{address})}.
1937@var{address} has the same form as the @var{local-address}
1938and @var{remote-address} arguments to @code{make-network-process}.
1939@end defun
1940
1941@defun network-interface-info ifname
1942This 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
1948The internet protocol address.
1949@item bcast
1950The broadcast address.
1951@item netmask
1952The network mask.
1953@item hwaddr
1954The layer 2 address (Ethernet MAC address, for instance).
1955@item flags
1956The current flags of the interface.
1957@end table
1958@end defun
1959
1960@defun format-network-address address &optional omit-port
1961This function converts the Lisp representation of a network address to
1962a 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
1968If @var{omit-port} is non-@code{nil}, the value does not include
1969the 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
2005Here are some of the option @var{keyword}s you can test in 1986@noindent
2006this way. 1987Here 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
2006on network connections.
2007
2008@defun network-interface-list
2009This function returns a list describing the network interfaces
2010of the machine you are using. The value is an alist whose
2011elements have the form @code{(@var{name} . @var{address})}.
2012@var{address} has the same form as the @var{local-address}
2013and @var{remote-address} arguments to @code{make-network-process}.
2014@end defun
2015
2016@defun network-interface-info ifname
2017This 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
2023The internet protocol address.
2024@item bcast
2025The broadcast address.
2026@item netmask
2027The network mask.
2028@item hwaddr
2029The layer 2 address (Ethernet MAC address, for instance).
2030@item flags
2031The current flags of the interface.
2032@end table
2033@end defun
2034
2035@defun format-network-address address &optional omit-port
2036This function converts the Lisp representation of a network address to
2037a 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
2043If @var{omit-port} is non-@code{nil}, the value does not include
2044the 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