Subject: clisp & sockets

From: "Jim Arvo" <[email-masked]>
Date: Fri, 21 May 1999 18:58:42 -0700

I wish to run clisp in a separate process (perhaps on another machine),
and communicate with it from C++.  I understand that on Unix platforms
the correct way to go about this is via sockets, but I need some help
getting started.  I have several questions:

1)  When I evaluate (socket-server 1), I get the error message

    *** - UNIX error 13 (EACCES): Permission denied

    Are there some magic port numbers I need to use?  (I've tried a bunch.)
    Must the Lisp process be running as root?

2)  Can someone point me to a VERY SIMPLE example of a C or C++ program that
    communicates with a Lisp environment via sockets?  I'm sure this is
    quite easy -- I just need a trivial example to start with.

3)  Are there any publicly-available Lisp packages (with corresponding
    C libraries) that provide a higher-level communication layer than
    sockets?

Any advice/information would be greatly appreciated.  Thanks.

    -- Jim Arvo

---

From: Eric Marsden <[email-masked]>
Date: Sun, 23 May 1999 16:10:20 +0200

>     Must the Lisp process be running as root?

Under Unix, binding to a port number under 1024 requires root priviledges
(and a number of the numbers have predefined meanings; see /etc/services).
As a user you can bind to anything above, but note that you can't count on
being able to use a specific number (as is generally necessary, since your C
program has to know in advance which port to connect to), because another
program may have had that port attributed to it by the system for a client
request.

You may find the following sites useful:

  <URL:http://www.lowtek.com/sockets/>
  <URL:http://www.ecst.csuchico.edu/~beej/guide/net/>
  <URL:http://www.landfield.com/faqs/unix-faq/socket/>

>     quite easy -- I just need a trivial example to start with.

CMUCL includes a Motif interface which works by issuing requests via a
socket to a server written in C. It's not very simple (and the Lisp side API
is different from CLISP, unfortunately), but it might be useful to you. The
source can be browsed at

   <URL:ftp://ftp2.cons.org/pub/languages/lisp/cmucl/src/motif/>

An example of using the CLISP sockets API is Bruno Haible's inspector, which
make CLISP communicate with a browser; see

   <URL:ftp://ftp2.cons.org/pub/languages/lisp/clisp/contrib/inspect2.lsp.gz>

>     C libraries) that provide a higher-level communication layer than

Not that I know of.

Hope that helps,

-- 
Eric Marsden
It's elephants all the way down