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

specifying protocol for service



    Date: Thu, 19 Apr 90 17:24:36 EST
    From: bouma@cs.purdue.edu

    When you call the function 'invoke-service-on-host' is there any way to
    specify the protocol for it to use? When I run that function on a host that
    is not in the namespace, I get thrown into the debugger. It does not know
    that that host supports that service. However, the first option in the
    debugger, s-A, asks to try the service anyway with some protocol the local
    machine knows about. I would like to give it the protocol I want to use
    and have it skip looking at the namespace. I should get into the debugger
    only if it fails to get a connection. Please tell me how this can be done.

I think this will work:

(defun invoke-service-on-host-if-possible (service host &rest service-args)
  (flet ((try-protocol (condition)
	   (dbg:initialize-special-commands condition)  ; Set up paths
	   (when (send condition :possible-paths)
	     (dbg:special-command condition :specify-path))))
    (condition-bind ((neti:host-does-not-support-service #'try-protocol))
      (apply #'net:invoke-service-on-host service host service-args))))

This will do exactly what s-A would do if you typed it, including querying
you if there is more than one possibility.  You can use RPLACD on the list
of possible paths if you always want the first one, or write a method for
the condition HOST-DOES-NOT-SUPPORT-SERVICE to update the instance variable
POSSIBLE-PATHS (which is not writable or settable) if you want to automate
things further.  See the method for DBG:SPECIAL-COMMAND on that condition
flavor for more information.