From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: How to communicate with a running external process with Date: Tue, 23 Jul 2013 15:22:31 +0700 Message-ID: References: <7DEC2F40B9E0874681480168A47FD3C11AF1E5E6@MSGPEXCEI32B.mfad.mfroot.org> <87txjlr9js.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1374567766 17125 80.91.229.3 (23 Jul 2013 08:22:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jul 2013 08:22:46 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thorsten Jolitz Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 23 10:22:47 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V1Xrr-0000oV-Dy for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jul 2013 10:22:47 +0200 Original-Received: from localhost ([::1]:45590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Xrr-0003KH-0s for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jul 2013 04:22:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Xrf-0003K0-O6 for help-gnu-emacs@gnu.org; Tue, 23 Jul 2013 04:22:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Xre-0006vz-6X for help-gnu-emacs@gnu.org; Tue, 23 Jul 2013 04:22:35 -0400 Original-Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]:44936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Xrd-0006vY-V9 for help-gnu-emacs@gnu.org; Tue, 23 Jul 2013 04:22:34 -0400 Original-Received: by mail-lb0-f177.google.com with SMTP id 10so5915479lbf.8 for ; Tue, 23 Jul 2013 01:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=KyXj58iC9i8vg2LytzP1RYu/HRpsyI0a73CMo9U+wH4=; b=xekV1uEUZmFhrv52kGvmYKQ61gfgNcXIU5zNjyXrXW/GI2pOaBsTKeTjGJfFAAdy2L Gv5nbvm/xBmFf+CDeH6w8kt0ODTG6GmGtwMtWMm9U0eGxLNwTbH9z17/Ljwn+LCocguW IB/aR7GWbq2YgFy0b91000SJhijt/RPESIXCjUUCco8zbCaqKs+eqUZfKmJ95lA2Lkae l8/kh3uOLHAwnvP1JSi0uiavCVK2MHO8YLIp8pFiV7/iD+1ksg37k8g/OSM1rSfT9suu vOW2j+NLQtDPaSt9U9heW4aO0mywF2YimeJosJuxq5H0PdUvCwQ3iteSHKklC3yTqu9L uAtA== X-Received: by 10.112.55.104 with SMTP id r8mr13727647lbp.49.1374567752236; Tue, 23 Jul 2013 01:22:32 -0700 (PDT) Original-Received: by 10.114.184.5 with HTTP; Tue, 23 Jul 2013 01:22:31 -0700 (PDT) In-Reply-To: <87txjlr9js.fsf@gmail.com> X-Google-Sender-Auth: tEktk25d8hVVMG1YBVodrS3DgKs X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::231 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92341 Archived-At: On Tue, Jul 23, 2013 at 2:59 PM, Thorsten Jolitz wrote: > Assume there are 2 otherLisp processes up and running and 2 Emacs > processes, and you want to communicate from otherLisp with PID 5555 to > Emacs with PID 6666. First, decide which program is the server and which is the client. A server, roughly speaking, is the process that first establishes the channel of communication =E2=80=94 creates a pipe, a Unix socket, or listen= s on a TCP port. Clients then have to know the pipe path/filename, the Unix socket path, or the IP address and TCP port, in order to connect to the server. Once the connection by client is established, both server and client have a file descriptor and can communicate just by writing into it. If you have two instances of the server, they have to listen on different pipes, Unix sockets (by path/name), or, in case of TCP, the pairs have to be distinct. Thus, the clients will be able to connect to the server they want, by knowing the specific server pipe or Unix socket path or IP address and TCP port. The process ID just never enters the picture. (Although, if you control the server, you can make up a convention that, e.g., the server always listens on the Unix socket with the path /var/run/your_server_name.$PID.)