<<<<<<< (null)="======"> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content> <meta name="GENERATOR" content="Microsoft FrontPage 2.0"> <title>dp_RPC</title> </head> <body bgcolor="#C0C0C0" text="#000000" link="#0000EE" vlink="#551A8B" alink="#FF0000"> <h3>dp_RPC</h3> <p><b>Syntax</b></p> <pre>dp_RPC <em>rpcChan</em> ?-timeout <em>amount</em> ?-timeoutReturn <em>script</em>?? ?-events <em>evtList</em>? <em>rpcCmd</em> ?args ...?</pre> <p><b>Comments</b></p> <p>dp_RPC allows one to send a Tcl expression to a remote Tcl interpreter to be evaluated by it. <em>rpcChan</em> is a channel opened with dp_connect and registered for RPCs with dp_admin. Unlike dp_RDO, this command waits for a return code, although because of the asynchronous nature of events and I/O, RPC return codes are not guaranteed in any specific order. If one does not need a return code, it is highly recommended that dp_RDO be used instead; it is much faster and far less complex.</p> <p>The timeout <em>amount</em> specifies how long dp_RPC will block before returning an error and is in milliseconds. <em>script</em> is the script to evaluate if the RPC times out. Specifying a timeout script without a timeout value is invalid. The prototype for the timeoutReturn script is as follows:</p> <pre>proc errorHandler {channelName} {}</pre> <p><em>evtList</em> is a normal Tcl event list that tells DP which events to respond to while waiting for the RPC to return. See the Tcl documentation on events for valid parameters.</p> <p>dp_RPC returns the return value of the <i>rpcCmd</i>.</p> <hr> <p>If you are using RPCs with just tclsh, an RPC will not execute asynchronously due to the fact that Tcl relies on Tcl_DoOneEvent() to process events. It is recommended that you use wish or add a vwait command in your script to force Tcl into an event loop. As an example, if you send an RPC to puts "foobar", the receiving intrepreter will not print "foobar" until update is called.</p> <hr> <p><b>Examples</b></p> <pre>dp_RPC $myChan puts stdout hello dp_RPC $myChan -timeout 100 puts stdout foo dp_RPC $myChan -timeout 100 -timeoutReturn "set a 1" -events all puts stdout hello</pre> </body> </html>