[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Symbolics<->Sun Lucid connection?



  | Date: Thu, 14 November 91, 13:10 EST
  | From: Hans Tallis
  |
  | I want to get lisp systems on two machines talking to each other (sending a
  | string of characters is enough; one machine blocks on a wait until the other
  | sends).  One machine is a Symbolics; the other, a Sun/Lucid. Is there a
  | relatively painless way to do this? 
  | 
  | (I considered RPC, but don't seem able to find any RPC documentation for Lucid.
  | Is there another way?)
  | 
  | --hans
  | tallis@starbase.mitre.org

My *favourite* question. We Sluggers have been through a series of
discussions/fights on this topic. Attached to this message are abstracts
from relevant earlier communications.

Note that pure Lucid offer no RPC library functions, but it's not that
difficult to conjure up your own one. Just use the foreign function
interface and write a few lines of C code. I've done it myself, and it
works well.

There are a couple of traps, though, related to the primitive (but fast)
communication protocol. For instance, you must make sure that your
requests are executed only once by the server (if you need
non-idempotent operations), or else you risk that the execution of your
request times out (by default after ~5 seconds) and is resent by the
client (by default ~5 times) and consequently re-executed if you aren't
prepared to handle this. What you need is to protect the execution of a
request within a "idempotent-protecting" macro, but that too is fairly
straight-forward to implement.

Good luck!

Eyvind.

+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
 Eyvind Ness                    Internet Email: eyvind@hrp.no
 Research Scientist             Phone: +47 9 183100
 Control Room Systems Division  Fax: +47 9 187109
 OECD Halden Reactor Project    Surface Mail: P.O. Box 173, N-1751 Halden
 Norway
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

(Two "pepperpots" watching TV with a penguin on top of their television set).

- Funny that penguin being there, isn't it? What's he doing there?
- Standing.
- I can see that.
- Perhaps it comes from next door?
- Penguins don't come from next door, they come from the Antarctic.
- Burma!
- Why did you say "Burma"?
- I panicked.

(Monty Python, Penguin sketch).


Here are some earlier messages from related discussions:
========================================================================
From: eyvind%hrp.no@Warbucks.AI.SRI.COM (Eyvind Ness)
To: Slug@ai.sri.com
Cc: svein%skrue.hrp.no@Warbucks.AI.SRI.COM,
        fridtjov%skrue.hrp.no@Warbucks.AI.SRI.COM,
        eyvind%skrue.hrp.no@Warbucks.AI.SRI.COM
Subject: Summary of RPC on Symbolics
Date: Thu, 15 Aug 91 08:32:08 met

Summary of discussion: the Symbolics RPC library.
-------------------------------------------------

Q (eyvind@hrp.no): Are there any utilities corresponding to the Sun
RPC library functions CALLRPC and REGISTERRPC available on Symbolics
3600s running Genera 8.0?

A (mainly barmar@think.com): No. For 3600s, Symbolics RPC depends on
the optional IP/TCP and NFS software packages. In Genera 8.1, however,
this is no problem because IP/TCP and NFS are bundled with the
release.

---000---

Caveat: Although RPC functionality is unavailable (actually it's
incomplete, which is even worse) on 3600s with Genera 8.0 or older,
all RPC-related functions are documented in the Document Examiner and
in the Networking Manual.


Notes: The programmer interface to Symbolics RPC looks a bit
unfamiliar to Explorer and Unix programmers at first sight. However,
the functionality is the same. Below is a little example showing some
of the differences.

Example: Client stub for calling remotefunction(string) -> string.

Explorer:

(callrpc
  host-name                        ;e.g. "remulus"
  program-number                   ;e.g. #x20abcdef
  version-number                   ;e.g. 1
  procedure-number                 ;e.g. 1
  ':xdr-ascii-string
  locf-query
  ;; e.g (defvar query "user-id") and (defvar locf-query (locf query))
  ':xdr-ascii-string)


Symbolics:

(rpc:define-remote-module
  program-name                          ;symbol
  (:number program-number)              ;as above
  (:version version-number)             ;as above
  (:client :lisp))                      ;tells Genera to make client stub

(rpc:define-remote-entry
  procedure-name                        ;symbol
  program-name
  (:number procedure-number)
  (:arguments
    (query string))
  (:values
    (reply string)))

;;; example call:
(procedure-name 
  "query"
  :transport-agent
  (rpc:host-udp-transport-agent (net:parse-host host-name)))

;;; End of example.

Eyvind.
======================== End of Message ================================

From: eyvind%hrp.no@Warbucks.AI.SRI.COM (Eyvind Ness)
To: kddlab!atr-la.atr.co.jp!myers@uunet.UU.NET
Cc: eyvind%skrue.hrp.no@Warbucks.AI.SRI.COM, slug@ai.sri.com
Subject: RPC Initialization
Date: Wed, 28 Aug 91 09:21:13 met

   Date: Wed, 28 Aug 91 13:39:48 +0900
   From: kddlab!atr-la.atr.co.jp!myers@uunet.UU.NET (John K. Myers)

   I have three LMs: an XL, a 3620, and a MacIvory.  I want any machine
   to be able to send data to, or run functions remotely on, any other
   specified machine.

   This appears to be a job for RPC.  Based on previous discussions,
   someone suggested I open a connection using
     (setq *LM05-link* (rpc:open-tcp-agent "LM05"))

It is a matter of taste, but personally I think TCP is overkill for RPC
which is a typical connectionless protocol.

   and then use 
     (execute-my-remote-function args more-args :transport-agent *LM05-link*)
   to invoke the RPC, after having gone through the mess of defining    
   the remote-module and the remote-entry.

   The current problem is that I get the following error message:
   Error: LM25 does not support RPC service.

   The following specials have been rebound; use :Show Standard Value Warnings for details:
     *PRINT-LEVEL*

   NET:FIND-PATHS-TO-SERVICE-ON-HOST
      Arg 0 (NETI:SERVICE): :RPC
      Arg 1 (NET:HOST): #<FS:LISPM-HOST LM25 22005606115>
      Arg 2 (NETI:ONLY-NEED-BEST): NIL
      Arg 3 (NETI:MUST-HAVE-ONE): T
   s-A:           Use protocol RPC-LITTLE-ENDER on medium TCP, or RPC on TCP.
   etc.

   when I try to open the tcp agent.  If I do a s-A, things seem
   to work O.K., but it apparently is using a different protocol than
   TCP (not that I understand nor care).

Is it really? Are you sure?

   Q: How can I get the program to init the RPC behavior without breaking
   out into an error message?  For instance, is there a function that I can
   call directly that sets up a "RPC-LITTLE-ENDER" protocol for me?
   Or is there some magic file that I have to edit to let one Symbolics know
   that another Symbolics has RPC capability?  Or should I use
   (setq *LM25-link* (rpc:open-chaos-agent "LM25"))?

Use the namespace database. Add a new Service attribute for the
machine(s) you want to RPC to. Typically something like (from the top of
my head - the details might be slightly incorrect):

Service: RPC (Medium) TCP (Protocol) RPC-LITTLE-ENDER

The CP command "Add Service to Host" (or something like it) could be
useful too.

   Q: I assume that I can simply call rpc:open-tcp-agent once at the beginning
   of the month, and then have that connection remain valid as long as 
   both machines are running.  Obviously, if I boot the sending machine,
   the connection dies.  What happens if I boot the receiving machine--
   is the connection established from the sending machine still valid?
   What happens if I power-down the MacIvory, and then turn it on again
   (same world)--are connections sent from the Mac still valid?  How about
   connections being received into the Mac?

Typical problems related to connection-oriented transports like TCP. In
my opinion: Use UDP instead and implement the kind of error-handling you
need yourself - it is really not so difficult, at least not in Lisp
under Genera.

   Q: If I use a chaos protocol, can I send strings containing Kanji
   and carriage-returns from one Symbolics to another?  On p.64 of the #13 Networks
   manual, it says that strings should only use the 95 nice printable ASCII characters.
   I couldn't get variable-length "opaque-byte" Kanji strings to work.

I suggest you utilise the Lisp reader (server) and printer (client) to
take care of these petty details. Just make the client send the
neccessary info to enable the server to reconstruct your data structure
at the server side. It might be inefficient, allright, but at least you
don't have to spend the rest of the month (re)inventing some dubious
conventions for transferring data over the net.


Eyvind Ness
eyvind@hrp.no

In case you've lost it - here is the *standard* RPC set-up (client) on a
Symbolics running Genera 8.1, or 8.0 with TCP/IP and NFS sent out to
slug Aug 15, not the call to RPC:HOST-UDP-TRANSPORT-AGENT:

(rpc:define-remote-module
  program-name                          ;symbol
  (:number program-number)              ;as above
  (:version version-number)             ;as above
  (:client :lisp))                      ;tells Genera to make client stub

(rpc:define-remote-entry
  procedure-name                        ;symbol
  program-name
  (:number procedure-number)
  (:arguments
    (query string))
  (:values
    (reply string)))

;;; example call:
(procedure-name 
  "query"
  :transport-agent
  (rpc:host-udp-transport-agent (net:parse-host host-name)))

;;; End of example.
======================== End of Message ================================