52 |
* Datagrams:: UDP network connections. |
* Datagrams:: UDP network connections. |
53 |
* Low-Level Network:: Lower-level but more general function |
* Low-Level Network:: Lower-level but more general function |
54 |
to create connections and servers. |
to create connections and servers. |
55 |
|
* Misc Network:: Additional relevant functions for network connections. |
56 |
* Byte Packing:: Using bindat to pack and unpack binary data. |
* Byte Packing:: Using bindat to pack and unpack binary data. |
57 |
@end menu |
@end menu |
58 |
|
|
1717 |
@node Low-Level Network |
@node Low-Level Network |
1718 |
@section Low-Level Network Access |
@section Low-Level Network Access |
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 |
|
|
1734 |
The basic function for creating network connections and network |
The basic function for creating network connections and network |
1735 |
servers is @code{make-network-process}. It can do either of those |
servers is @code{make-network-process}. It can do either of those |
1736 |
jobs, depending on the arguments you give it. |
jobs, depending on the arguments you give it. |
1867 |
Initialize the process plist to @var{plist}. |
Initialize the process plist to @var{plist}. |
1868 |
@end table |
@end table |
1869 |
|
|
1870 |
The following network options can be specified for the network |
The original argument list, modified with the actual connection |
1871 |
process. Except for @code{:reuseaddr}, you can set or modify these |
information, is available via the @code{process-contact} function. |
1872 |
options later using @code{set-network-process-option}. |
@end defun |
1873 |
|
|
1874 |
|
@node Network Options |
1875 |
|
@subsection Network Options |
1876 |
|
|
1877 |
For a server process, the options specified with |
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 |
1882 |
@code{make-network-process} are not inherited by the client |
@code{make-network-process} are not inherited by the client |
1883 |
connections, so you will need to set the necessary options for each |
connections, so you will need to set the necessary options for each |
1884 |
child connection as they are created. |
child connection as it is created. |
1885 |
|
|
1886 |
@table @asis |
@table @asis |
1887 |
@item :bindtodevice @var{device-name} |
@item :bindtodevice @var{device-name} |
1936 |
may be a period of time after the last use of that port (by any |
may be a period of time after the last use of that port (by any |
1937 |
process on the host), where it is not possible to make a new server on |
process on the host), where it is not possible to make a new server on |
1938 |
that port. |
that port. |
|
|
|
1939 |
@end table |
@end table |
1940 |
|
|
|
The original argument list, modified with the actual connection |
|
|
information, is available via the @code{process-contact} function. |
|
|
@end defun |
|
|
|
|
1941 |
@defun set-network-process-option process option value |
@defun set-network-process-option process option value |
1942 |
This function sets or modifies a network option for network process |
This function sets or modifies a network option for network process |
1943 |
@var{process}. See @code{make-network-process} for details of options |
@var{process}. See @code{make-network-process} for details of options |
1947 |
@code{process-contact} function. |
@code{process-contact} function. |
1948 |
@end defun |
@end defun |
1949 |
|
|
1950 |
@defun network-interface-list |
@node Network Feature Testing |
1951 |
This function returns a list describing the network interfaces |
@subsection Testing Availability of Network Features |
|
of the machine you are using. The value is an alist whose |
|
|
elements have the form @code{(@var{name} . @var{address})}. |
|
|
@var{address} has the same form as the @var{local-address} |
|
|
and @var{remote-address} arguments to @code{make-network-process}. |
|
|
@end defun |
|
|
|
|
|
@defun network-interface-info ifname |
|
|
This function returns information about the network interface named |
|
|
@var{ifname}. The value is a list of the form |
|
|
@code{(@var{addr} @var{bcast} @var{netmask} @var{hwaddr} @var{flags})}. |
|
|
|
|
|
@table @var |
|
|
@item addr |
|
|
The internet protocol address. |
|
|
@item bcast |
|
|
The broadcast address. |
|
|
@item netmask |
|
|
The network mask. |
|
|
@item hwaddr |
|
|
The layer 2 address (Ethernet MAC address, for instance). |
|
|
@item flags |
|
|
The current flags of the interface. |
|
|
@end table |
|
|
@end defun |
|
|
|
|
|
@defun format-network-address address &optional omit-port |
|
|
This function converts the Lisp representation of a network address to |
|
|
a string. For example, a five-element vector @code{[@var{a} @var{b} |
|
|
@var{c} @var{d} @var{p}]} represents an IP address |
|
|
@var{a}.@var{b}.@var{c}.@var{d} and port number @var{p}. |
|
|
@code{format-network-address} converts that to the string |
|
|
@code{"@var{a}.@var{b}.@var{c}.@var{d}:@var{p}"}. |
|
|
|
|
|
If @var{omit-port} is non-@code{nil}, the value does not include |
|
|
the port number. |
|
|
@end defun |
|
1952 |
|
|
1953 |
To test for the availability of a given network feature, use |
To test for the availability of a given network feature, use |
1954 |
@code{featurep} like this: |
@code{featurep} like this: |
1983 |
(featurep 'make-network-process '@var{keyword}) |
(featurep 'make-network-process '@var{keyword}) |
1984 |
@end example |
@end example |
1985 |
|
|
1986 |
Here are some of the option @var{keyword}s you can test in |
@noindent |
1987 |
this way. |
Here are some of the options you can test in this way. |
1988 |
|
|
1989 |
@table @code |
@table @code |
1990 |
@item :bindtodevice |
@item :bindtodevice |
1999 |
@code{make-network-process} and @code{set-network-process-option}. |
@code{make-network-process} and @code{set-network-process-option}. |
2000 |
@end table |
@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. |
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 |
|
|
2047 |
@node Byte Packing |
@node Byte Packing |
2048 |
@section Packing and Unpacking Byte Arrays |
@section Packing and Unpacking Byte Arrays |
2049 |
|
|