Go to the first, previous, next, last section, table of contents.


Network Connections

Emacs Lisp programs can open TCP network connections to other processes on the same machine or other machines. A network connection is handled by Lisp much like a subprocess, and is represented by a process object. However, the process you are communicating with is not a child of the Emacs process, so you can't kill it or send it signals. All you can do is send and receive data. delete-process closes the connection, but does not kill the process at the other end; that process must decide what to do about closure of the connection.

You can distinguish process objects representing network connections from those representing subprocesses with the process-status function. It always returns either open or closed for a network connection, and it never returns either of those values for a real subprocess. See section Process Information.

Function: open-network-stream name buffer-or-name host service
This function opens a TCP connection for a service to a host. It returns a process object to represent the connection.

The name argument specifies the name for the process object. It is modified as necessary to make it unique.

The buffer-or-name argument is the buffer to associate with the connection. Output from the connection is inserted in the buffer, unless you specify a filter function to handle the output. If buffer-or-name is nil, it means that the connection is not associated with any buffer.

The arguments host and service specify where to connect to; host is the host name (a string), and service is the name of a defined network service (a string) or a port number (an integer).


Go to the first, previous, next, last section, table of contents.