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

[no subject]



Dear SLUG's

  I'm trying to develop a fast communications link between two Symbolics
machines. Information sent between hosts are in the form of ASCII strings.
The following code, which would be loaded on both hosts, is our current
implementation:

-----BEGIN--------------------------------------------------------------------

;;; -*- Mode: LISP; Syntax: Common-lisp; Package: BLK; Base: 10; -*-
;


(CHAOS:ADD-CONTACT-NAME-FOR-PROTOCOL :simple-eval)   ; Chaos socket setup.
(EVAL-WHEN (LOAD)
  (TCP:ADD-TCP-PORT-FOR-PROTOCOL :simple-eval 1000)) ; TCP socket setup.


(NET:DEFINE-PROTOCOL :simple-eval (:simple-eval :BYTE-STREAM)
  (:INVOKE-WITH-STREAM-AND-CLOSE ((stream :ASCII-TRANSLATION t :CHARACTERS t)
                                  form)
    ;Send form and read result in known environment.
    (SCL::WITH-STANDARD-IO-ENVIRONMENT
      (PRINT form stream)
      (FORCE-OUTPUT stream)
      (APPLY 'values (PROG1 (READ stream)
                            (LOOP WHILE (SCL::SEND stream :TYI)))))))


(NET:DEFINE-SERVER :simple-eval (:MEDIUM :BYTE-STREAM
                                 :STREAM 
                                  (stream :ACCEPT-P t :ASCII-TRANSLATION t
                                     :CHARACTERS t))
   (SCL::WITH-STANDARD-IO-ENVIRONMENT
     (PRINT (MULTIPLE-VALUE-LIST (EVAL (READ stream))) stream))
   (FORCE-OUTPUT stream))


;; Local simple eval protpcal.
(NET:DEFINE-PROTOCOL :local-simple-eval (:simple-eval :LOCAL)
  (:INVOKE (sap)
    ;Read form and print result in known environment.
    (scl::WITH-STANDARD-IO-ENVIRONMENT
      (EVAL (CAR (NETI:SERVICE-ACCESS-PATH-ARGS sap))))))
;; --------------------


(DEFUN net-eval (form &OPTIONAL (host *remote-host*))
  (NETI:INVOKE-SERVICE-ON-HOST :simple-eval host form))

-----END----------------------------------------------------------------------


  For example, say we have two hosts A and B, then we can send a form
from A have it evaluated on B and the result sent back to A.

;; Command to send form from host A.
(setq result (net-eval '(foo '(a b c)) (SI:PARSE-HOST 'B)))

  The communication time required to send the form to host B, evaluate
it, and return the result back to A is the most time consuming. One possible
way to speed things up is to keep the stream  open during the session and
close it upon exiting the program (although not to sure how to do this).

Anyway, if you have any ideas or know of a faster way to implement this,
please let me know. Thanks in advance.

							Steve

*******************************************************************************
Steve Smith                          | Internet: smith@icat.larc.nasa.gov
NASA Langley Research Center         |
M/S 152                              | Voice: (804) 864-2004
Hampton, VA 23665                    | FAX  : (804) 864-7793
*******************************************************************************