The basic function for creating network connections and network
make-network-process. It can do either of those
jobs, depending on the arguments you give it.
This function creates a network connection or server and returns the process object that represents it. The arguments args are a list of keyword/argument pairs. Omitting a keyword is always equivalent to specifying it with value
nil, except for
:reuseaddr. Here are the meaningful keywords:
- :name name
- Use the string name as the process name. It is modified if necessary to make it unique.
- :type type
- Specify the communication type. A value of
nilspecifies a stream connection (the default);
datagramspecifies a datagram connection;
seqpacketspecifies a “sequenced packet stream” connection. Both connections and servers can be of these types.
- :server server-flag
- If server-flag is non-
nil, create a server. Otherwise, create a connection. For a stream type server, server-flag may be an integer which then specifies the length of the queue of pending connections to the server. The default queue length is 5.
- :host host
- Specify the host to connect to. host should be a host name or Internet address, as a string, or the symbol
localto specify the local host. If you specify host for a server, it must specify a valid address for the local host, and only clients connecting to that address will be accepted.
- :service service
- service specifies a port number to connect to, or, for a server, the port number to listen on. It should be a service name that translates to a port number, or an integer specifying the port number directly. For a server, it can also be
t, which means to let the system select an unused port number.
- :family family
- family specifies the address (and protocol) family for communication.
nilmeans determine the proper address family automatically for the given host and service.
localspecifies a Unix socket, in which case host is ignored.
ipv6specify to use IPv4 and IPv6 respectively.
- :local local-address
- For a server process, local-address is the address to listen on. It overrides family, host and service, and you may as well not specify them.
- :remote remote-address
- For a connection, remote-address is the address to connect to. It overrides family, host and service, and you may as well not specify them.
For a datagram server, remote-address specifies the initial setting of the remote datagram address.
The format of local-address or remote-address depends on the address family:
- An IPv4 address is represented as a five-element vector of four 8-bit integers and one 16-bit integer
[a b c d p
]corresponding to numeric IPv4 address a.b.c.d and port number p.
- An IPv6 address is represented as a nine-element vector of 16-bit integers
[a b c d e f g h p
]corresponding to numeric IPv6 address a:b:c:d:e:f:g:h and port number p.
- A local address is represented as a string which specifies the address in the local address space.
- An “unsupported family” address is represented by a cons
), where f is the family number and av is a vector specifying the socket address using one element per address data byte. Do not rely on this format in portable code, as it may depend on implementation defined constants, data sizes, and data structure alignment.
- :nowait bool
- If bool is non-
nilfor a stream connection, return without waiting for the connection to complete. When the connection succeeds or fails, Emacs will call the sentinel function, with a second argument matching
"open"(if successful) or
"failed". The default is to block, so that
make-network-processdoes not return until the connection has succeeded or failed.
- :stop stopped
- Start the network connection or server in the `stopped' state if stopped is non-
- :buffer buffer
- Use buffer as the process buffer.
- :coding coding
- Use coding as the coding system for this process. To specify different coding systems for decoding data from the connection and for encoding data sent to it, specify
If you don't specify this keyword at all, the default is to determine the coding systems from the data.
- :noquery query-flag
- Initialize the process query flag to query-flag. See Query Before Exit.
- :filter filter
- Initialize the process filter to filter.
- :sentinel sentinel
- Initialize the process sentinel to sentinel.
- :log log
- Initialize the log function of a server process to log. The log function is called each time the server accepts a network connection from a client. The arguments passed to the log function are server, connection, and message, where server is the server process, connection is the new process for the connection, and message is a string describing what has happened.
- :plist plist
- Initialize the process plist to plist.
The original argument list, modified with the actual connection information, is available via the