aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/subr.el83
1 files changed, 83 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 2636ccadea9..e6b0ca945a4 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -913,6 +913,89 @@ evaluated whenever that feature is `provide'd."
913This makes or adds to an entry on `after-load-alist'. 913This makes or adds to an entry on `after-load-alist'.
914FILE should be the name of a library, with no directory name." 914FILE should be the name of a library, with no directory name."
915 (eval-after-load file (read))) 915 (eval-after-load file (read)))
916
917;;; make-network-process wrappers
918
919(if (featurep 'make-network-process)
920 (progn
921
922(defun open-network-stream (name buffer host service)
923 "Open a TCP connection for a service to a host.
924Returns a subprocess-object to represent the connection.
925Input and output work as for subprocesses; `delete-process' closes it.
926Args are NAME BUFFER HOST SERVICE.
927NAME is name for process. It is modified if necessary to make it unique.
928BUFFER is the buffer (or buffer-name) to associate with the process.
929 Process output goes at end of that buffer, unless you specify
930 an output stream or filter function to handle the output.
931 BUFFER may be also nil, meaning that this process is not associated
932 with any buffer
933Third arg is name of the host to connect to, or its IP address.
934Fourth arg SERVICE is name of the service desired, or an integer
935specifying a port number to connect to."
936 (make-network-process :name name :buffer buffer
937 :host host :service service))
938
939(defun open-network-stream-nowait (name buffer host service &optional sentinel filter)
940 "Initiate connection to a TCP connection for a service to a host.
941It returns nil if non-blocking connects are not supported; otherwise,
942it returns a subprocess-object to represent the connection.
943
944This function is similar to `open-network-stream', except that this
945function returns before the connection is established. When the
946connection is completed, the sentinel function will be called with
947second arg matching `open' (if successful) or `failed' (on error).
948
949Args are NAME BUFFER HOST SERVICE SENTINEL FILTER.
950NAME, BUFFER, HOST, and SERVICE are as for `open-network-stream'.
951Optional args, SENTINEL and FILTER specifies the sentinel and filter
952functions to be used for this network stream."
953 (if (featurep 'make-network-process '(:nowait t))
954 (make-network-process :name name :buffer buffer :nowait t
955 :host host :service service
956 :filter filter :sentinel sentinel)))
957
958(defun open-network-stream-server (name buffer service &optional sentinel filter)
959 "Create a network server process for a TCP service.
960It returns nil if server processes are not supported; otherwise,
961it returns a subprocess-object to represent the server.
962
963When a client connects to the specified service, a new subprocess
964is created to handle the new connection, and the sentinel function
965is called for the new process.
966
967Args are NAME BUFFER SERVICE SENTINEL FILTER.
968NAME is name for the server process. Client processes are named by
969appending the ip-address and port number of the client to NAME.
970BUFFER is the buffer (or buffer-name) to associate with the server
971process. Client processes will not get a buffer if a process filter
972is specified or BUFFER is nil; otherwise, a new buffer is created for
973the client process. The name is similar to the process name.
974Third arg SERVICE is name of the service desired, or an integer
975specifying a port number to connect to. It may also be t to selected
976an unused port number for the server.
977Optional args, SENTINEL and FILTER specifies the sentinel and filter
978functions to be used for the client processes; the server process
979does not use these function."
980 (if (featurep 'make-network-process '(:server t))
981 (make-network-process :name name :buffer buffer
982 :service service :server t :noquery t
983 :sentinel sentinel :filter filter)))
984
985)) ;; (featurep 'make-network-process)
986
987
988;; compatibility
989
990(defun process-kill-without-query (process &optional flag)
991 "Say no query needed if PROCESS is running when Emacs is exited.
992Optional second argument if non-nil says to require a query.
993Value is t if a query was formerly required.
994New code should not use this function; use `process-query-on-exit-flag'
995or `set-process-query-on-exit-flag' instead."
996 (let ((old (process-query-on-exit-flag process)))
997 (set-process-query-on-exit-flag process nil)
998 old))
916 999
917 1000
918;;;; Input and display facilities. 1001;;;; Input and display facilities.