From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to communicate with a running external process with
Date: Tue, 23 Jul 2013 11:30:37 +0200 [thread overview]
Message-ID: <87haflr5c2.fsf@gmail.com> (raw)
In-Reply-To: CAP_d_8VWGqgouEba=YYHZUCi7SEEp3_Sa+Xy0evJSpYYDc=agQ@mail.gmail.com
Yuri Khan <yuri.v.khan@gmail.com> writes:
> On Tue, Jul 23, 2013 at 2:59 PM, Thorsten Jolitz <tjolitz@gmail.com> 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 — creates a pipe, a Unix socket, or listens
> 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
> <IP address:port> 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.)
ok, I think now I get it - just like starting a TCP server and then
accessing its <IP address:port> , the otherLisp (as a server) has to
open a pipe or socket first (which do have a path/filename), and knowing
the path/filename I can access that otherLisp process that acts as a
server from an Emacs Lisp program.
Vice versa it should be possible to open a pipe or socket from Emacs
Lisp (without starting a subprocess of otherLisp), and connect to it
from otherLisp using the specific path/filename.
I think I have to take a second look at the manuals wrt this idea. So in
both Lisp dialect there should be a way to open a pipe or socket, return
the path/filename of it, and keep listening for incoming connections
until it is closed. Thanks for the tips.
--
cheers,
Thorsten
next prev parent reply other threads:[~2013-07-23 9:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-22 15:27 How to communicate with a running external process with Buchs, Kevin J.
2013-07-23 7:59 ` Thorsten Jolitz
2013-07-23 8:22 ` Yuri Khan
2013-07-23 9:30 ` Thorsten Jolitz [this message]
2013-07-23 19:09 ` Pascal J. Bourguignon
2013-07-23 20:13 ` Thorsten Jolitz
2013-07-23 23:06 ` Pascal J. Bourguignon
2013-07-24 6:34 ` Thorsten Jolitz
[not found] ` <mailman.1659.1374606578.12400.help-gnu-emacs@gnu.org>
2013-07-23 19:12 ` Pascal J. Bourguignon
2013-07-23 20:15 ` Thorsten Jolitz
[not found] ` <mailman.1619.1374566396.12400.help-gnu-emacs@gnu.org>
2013-07-23 14:43 ` Barry Margolin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87haflr5c2.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.