(index ("rpc:publish-procedure!" 0) ("rpc:withdraw-procedure!" 651) ("rpc:default-server-port" 1251) ("rpc:connect-procedure" 1422) ("rpc:is-connected?" 1641) ("rpc:get-connection" 1924) ("rpc:close-connection!" 2238) ("rpc:close-all-connections!" 2549) ("rpc:current-peer" 2711) ("rpc:procedure" 3079) ("rpc:make-server" 4553))
(def (sig (procedure "(rpc:publish-procedure! name procedure #!optional (callback-outgoing? #t)) => <void>" (id rpc:publish-procedure!))) (p "Registers " (tt "procedure") " to be callable by incoming RPC requests under the name " (tt "name") ".") (p "Names of procedures are matched using " (tt "equal?") ".") (p "If " (tt "callback-outgoing?") " is true, a reverse lookup entry associating the procedure with its name is also created. The table of reverse lookup entries is used by " (tt "rpc:procedure") " to send a callback stub to the remote machine instead of the procedure itself, should the procedure be one of the parameters of a RPC call."))
(def (sig (procedure "(rpc:withdraw-procedure! name-or-procedure) => <void>" (id rpc:withdraw-procedure!))) (p "Unregisters the given " (tt "name-or-procedure") " as an externally callable object.  If a procedure is passed for the " (tt "name-or-procedure") " parameter, it can only successfully be removed if a reverse lookup entry for this procedure exists.") (p "As mutex lock intervals are kept as short as possible, it may happen, that a currently active server thread calls the procedure once more immediately after its removal before it becomes completely unavailable to the outside world."))
(def (sig (parameter "rpc:default-server-port" (id rpc:default-server-port))) (p "The standard port number to establish RPC connections to. The default value is 29296."))
(def (sig (parameter "rpc:connect-procedure" (id rpc:connect-procedure))) (p "The procedure used to establish network connections for RPC. Defaults to " (tt "tcp-connect") " and must be signature-compatible with it."))
(def (sig (procedure "(rpc:is-connected? host #!optional (port (rpc:default-server-port))) => <boolean>" (id rpc:is-connected?))) (p "Determines whether an RPC connection to the given " (tt "host") " and " (tt "port") " is active. The table of active connections is thread-local."))
(def (sig (procedure "(rpc:get-connection host #!optional (port (rpc:default-server-port))) => <input-port>, <output-port>" (id rpc:get-connection))) (p "Retrieves an existing RPC connection to the given " (tt "host") " and " (tt "port") " or creates a new one. The table of active connections is thread-local."))
(def (sig (procedure "(rpc:close-connection! host #!optional (port (rpc:default-server-port))) => <void>" (id rpc:close-connection!))) (p "Closes an existing RPC connection to the given " (tt "host") " and " (tt "port") ". Fails if no such connection exists. The table of active connections is thread-local."))
(def (sig (procedure "(rpc:close-all-connections!) => <void>" (id rpc:close-all-connections!))) (p "Closes all existing RPC connections of the current thread."))
(def (sig (parameter "rpc:current-peer" (id rpc:current-peer))) (p "Inside the server threads processing RPC requests, this parameter is set to the address (as a string) of the peer on behalf of which the thread is executing.") (p (i "Consider this parameter read-only unless you really know what you are doing. You may seriously mess up communications otherwise.")))
(def (sig (procedure "(rpc:procedure name host #!optional (port (rpc:default-server-port))) => <procedure>" (id rpc:procedure))) (p "Creates a procedure that can be called with any number of parameters to invoke the externally callable procedure published as " (tt "name") " on the server at " (tt "host:port") " with the given arguments.") (p "The arguments are scanned for procedures and if any such are found, those in the reverse lookup table are replaced with callback stubs before all the parameters are serialized over the network connection. Callback stubs are small procedures that use the value of the " (tt "rpc:current-peer") " and " (tt "rpc:default-server-port") " parameters in the remote server thread in order to determine where they came from and to use " (tt "rpc:procedure") " again to connect back to their home and execute their real counterpart.") (p "Some care has been taken to isolate code executing in an RPC server thread properly:") (ul (li "Exceptions caused in the remotely executing code are caught, sent back to the client and rethrown there.") (li "The " (tt "current-input-port") ", " (tt "current-output-port") " and " (tt "current-error-port") " parameters are changed for the remotely executing code. " (tt "current-input-port") " never yields any input and the two output ports accumulate data into strings that are sent back to the client and printed on the " (tt "current-output-port") " and " (tt "current-error-port") " there.")))
(def (sig (procedure "(rpc:make-server listener) => <procedure>" (id rpc:make-server))) (p "Uses " (tt "make-tcp-server") " to create a server procedure.  The server threads spawned by this procedure are continuously processing RPC requests from their clients until the connection is closed."))
