netcall

George Peter Staplin 2007 Nov, 14 - Netcall is a remote eval package. It's optimized for speed, and is somewhat like comm, though works differently at the API level. It's used in the Whim window manager.

It's BSD/Tcl licensed (the same license as Whim).

Getting the Sources

svn checkout http://megapkg.googlecode.com/svn/trunk/netcall netcall

(dead link on 2012-08-24)

Examples

A simple example for a server:

 set dir [file dirname [info script]]
 source [file join $dir netcall.tcl]
 netcall-serve 8123
 vwait forever

The clients can do:

 set dir [file dirname [info script]]
 source [file join $dir netcall.tcl]
 netcall-connect localhost 8123
 puts "SERVER PID is:[netcall pid]"
 puts "SERVER COMMANDS are:[netcall info commands]"

Now there's also some more power available. You can wait for variables to change on the server side.

 set changedby [netcall-vwait ::someservervar ::anotherservervar]

By default netcall takes args as a parameter. If you already have a command that is a list you can use:

 set result [netcall-1 $somecommand]

If you are concerned about security you can change/override/replace this on the server:

 proc netcall-permit-access? { addr port } {
         if {"127.0.0.1" eq $addr} {
                 return 1
         }

         if {![catch {package present Tk}]} {
                 set answer [tk_messageBox -icon question -type yesno \
                         -message "Do you want to allow $addr to connect to your netcall server?"]
                 return [expr {"yes" eq $answer}]
         }
         return 0
 }