How can Tcl programs on two different machines communicate

Purpose: discuss and document various techniques for two Tcl applications to communicate - inter-machine.


One might also try MOST.


In article http://deja.com/=dnc/getdoc.xp?AN=697080728 , Cameron Laird says:

'Depends. Here are four likely protocols:
    1. Your remote Unix station is set up to allow rsh access (you can validate this with trials from another Unix host). Use Tcl/Tk to drive a Win9x command-line rsh client, or write enough pure Tcl code to speak rsh directly.
      A lot of us system administrators find rsh creepy, for security reasons.
    2. Use ssh. Maybe you've got an sshd running on the Unix box already. In that case, find a Win9x command-line ssh client, and control it with Tcl/Tk. One can, in principle, code an ssh client in Tcl; that looks to me like a biiiiig job, though.
    3. I suspect what you'll choose is telnet. Use the Win* version of Expect to telnet to Unix, manage the login, and invoke the remote command you're after.
    4. It's not hard to code your own tiny process server in Tcl for the Unix host. At that point, an even tinier Tcl-based client can tickle it to accomplish the result you're after.
I summarize: it depends on the details of your computing and security environment. Is rshd running? sshd? How much security do you want?

Another possibility is the xmlrpc-protocol.

Steve Ball has written a tcl implementation of this protocol using tclhttpd as requesting server (the package is at http://www.zveno.com/zm.cgi/in-tclxml/in-xmlrpc.tml , the protocol-description at http://frontier.userland.com/tree$2.8.2 . This is imhO a very elegant solution for loosely coupled systems. It's even easy to trigger actions from a server on a client-machine, which is running the tclhttpd as a scripted document. JH 29.11


Here is a fun little item: securePipe

Here is a page containing example an example server and client for a protocol which demonstrates how easy it is to do something sophisticated in tcl: telnet (It is not a full telnet implementation though; that gets nasty and hard...)


Another popular method is via the comm extension:

 What: comm
 Where: http://www.schooner.com/%7Eloverso/tcl-tk/
 Description: A pure-Tcl replacement for send, called comm, that uses
        Tcl 7.5 (and later) socket command.  Allows Tcl only scripts to
        communicate and works under Windows.  This is semantically
        identical to send, both for complex transfers and error cases.
        Also allows notification when a remote interp dies.
        No interp registration is performed.
 Updated: 12/1998
 Contact: mailto:[email protected] (John Robert LoVerso)

Note that comm was recently integrated into Tcllib.


JCW wrote and maintains Tequila.


 What: apptalk
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/apptalk1.0b1.tar.gz
 Description: Tcl only procedure for enabling inter-application communication.
        It is a front-end to Tk's send command.  Most useful for
        applications that provide 'generic' services such as text editing,
        email, web browsing, etc.
 Updated: 10/1998
 Contact: mailto:[email protected] (Bryan Oakley)
   notes: (April, 2005) I wrote this *ages* ago and no longer have the source. 
          Some time in the past I discovered it on an old FTP site but it's probably 
          long gone. It was a fun exercise in the first year or so into my Tcl journey.

 What: Combat (Was: tclmico)
 Where: http://www.informatik.uni-frankfurt.de/%7Efp/Tcl/Combat/
        http://www.vsb.informatik.uni-frankfurt.de/%7Emico/
        http://www.mico.org/
 Description: Tcl interface to MICO (Mico Is COrba).  MICO is a free
        CORBA 2.0 implementation.  MICO provides CORBA client functionality
        to Tcl scripts.
        Combat plugs into CORBA 2.3's DII (Dynamic Invocation Interface) and
        DSI (Dynamic Skeleton Interface) to allow client- and server-side
        Tcl scripting.
        Also available at the site is an IOR string dump utility, a CORBA
        Naming Service (CNS) Client, an Interface Repository (IFR) client
        and patches for MICO 2.3.1 which adds support for corbaloc protocol.
        A binary distribution for Win32 is also available.
        For server-side scripting, you need Tcl 8.0.3+ and [incr Tcl] 3.0+.
        Recommended to use MICO 2.3.1 or better.
        Currently this is at version 0.6.
        The latest version should work with any CORBA 2.3 ORB.
 Updated: 05/2000
 Contact: mailto:[email protected] (Frank Pilhofer)


 What: DCOP
 Where: From the contact
        http://www.kdevelop.org/doc/addendum/
        ''that dir is empty by 7/2002''

        Better links
          http://developer.kde.org/documentation/library/kdeqt/dcop.html
          http://www.kde.com/websites/search.php?q=dcop&id=developer.kde.org&ssites%5B%5D=developer.kde.org&noSecCookieLogon=true
        No download found yet.

 Description:  Library for drag and drop support, with bindings for Java,
        Python, Perl and Tcl.  Allows one to drag and drop between apps of
        any of these langauges.  Conceptually like COM - a protocol for
        applications to speak to one another.  DCOP is the interprocess
        communication protocol used under KDE - a lightweight alternative
        to CORBA.
 Updated: 11/2000
 Contact: mailto:[email protected] (Matthias Kalle Dalheimer)
 ----

 What: DpTcl
 Where: http://members.cox.net/gerald.lester/DpTcl.tar.gz
 Description: A Tcl only package compatible with TclDp,
         supplying advanced TCP/IP connectivity.
         Not actively maintained
 Updated: 12/2005
 Contact: mailto:[email protected]  (Gerald Lester)

 What: EasySocket
 Where: http://www.cs.umn.edu/%7Edejong/tcl/EasySocket.tar.gz
 Description: An OO style Tcl class that provides async socket functionality
        without requiring that the user know all the details of socket and
        fileevent commands. Currently at version 0.2.
        Peter Tutko (see second Contact) has written itcl classes for
        EasySocket and was working on a similar class for EasyServer.
        Contact him for code.
 Updated: 12/1999
 Contact: http://www.cs.umn.edu/%7Edejong/
        mailto:[email protected]

 What: hub
 Where: http://home.sprynet.com/%7Eetailor/hub/hub.htm
 Description: The HUB is a software message exchange.
        It provides reliable dispatching and broadcasting of text messages
        that are accessed using internet TCP/IP client connections.
        Both server and client code is available.  It is not however
        dedicated to just being a chat server/client.  It can be configured
        for broadcasting, message saving, etc.
 Updated: 07/2000
 Contact: mailto:[email protected] (Eric Taylor)
 ----


 What: jTcl
 Where: http://www.fridu.com/
        http://www.fridu.com/Html/jTcl.html
        http://www.fridu.com/Html/download.html
 Description: A flying Tcl parser allowing Java-like object interface
        to Tcl.  Provides debugging facilities, network classes, rules
        server, serialization mechanism, and a package mechanism similar to
        Java's import.
        Class libraries for generic tcp client/server, web serving,
        application serving, session serving, and rule serving are
        provided.  Demos of chat, web, and rule servers are provided.
        Allows one to design web applications in Tcl with
        a Java syntax.  It is Tcl only, requires no extensions, and
        runs on all platforms supporting Tcl.
 Updated: 10/1998
 Contact: mailto:[email protected] (Philippe Le Foll)

 What: NeoSoft Tcl
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/neosoft/neotcl/
 Description: Tcl 7.6 and 8.0 set of commands and libraries providing
        interfaces to disk-based btree and hashtables,
        TCP/IP server-client objects,
        along with examples of an IRC robot object, RFC931 authentication
        object, support for WWW CGI scripts, WWW log file parsing.
        Also, this includes file requestors, dialog boxes, pull-down menus,
        class libraries for databases, listboxes, a Tk notepad, progress
        notifiers, UDP-based object sharing, and more.  Package includes
        Tcl, Tk, itcl, Tcl-DP, tclX, color pixmap and GIF support,
        and Expect.
 Updated: 10/1998
 Contact: mailto:[email protected] (Neosoft support)

 What: scotty
 Where: http://wwwhome.cs.utwente.nl/%7Eschoenw/scotty/
        http://www.cs.tu-bs.de/ibr/projects/nm/scotty/
        http://www.ibr.cs.tu-bs.de/projects/scotty/
        ftp://ftp.ibr.cs.tu-bs.de/pub/local/tkined/scotty-2.1.9.tar.gz
        ftp://ftp.ibr.cs.tu-bs.de/pub/local/tkined/devel/scotty-99-07-04-win.zip
        http://www.cs.columbia.edu/%7Eetgold/software/
 Description: scotty is a Tcl interpreter with extensions (Tnm) needed to write
        network management applications. scotty can send and receive
        ICMP packets, query DNS server, create TCP and UDP connections,
        retrieve SNMP information, talk HTTP, Sun RPC, and NTP, and
        process jobs in an event loop.
        Sample applications are provided for the tkined network editor
        A CVS repository is available for getting the very latest source.
        See the etgold directory for some scripts that use Scotty to get
        weather information, manage HP hubs, etc.
 Updated: 02/2000
 Contact: mailto:[email protected] (Tkined/Scotty mailing list admin)

 ----

 What: sendx
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/x11/sendx-0.1/sendx-0.1.tar.gz
 Description: Tcl extension implementing commands to send strings or
        XStrings to any X11 window via the XSendEvent function.
 Updated: 10/1998
 Contact: Unknown

 What: SIMPL
 Where: http://www.holoweb.net/%7Esimpl/
        https://sourceforge.net/projects/simpl/
 Description: Simple send/receive/reply messaging scheme. Includes a number
        of Tcl/Tk applications and tclets.
        Open Source developed for Linux.
        Currently at v2.3.3.
 Updated: 02/2005
 Contact: bobfcsoft at users.sourceforge.net

 What: SSLtcl
 Where: http://www.abc.se/%7Em339/prog/ssl/SSLtcl.html
        http://www.abc.se/%7Em9339/prog/ssl/SSLtcl-0.42.tar.gz
        ftp://ftp.mc.hik.se/pub/users/mia95anp/ssl/SSLtcl-0.42.tar.gz
        ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/net/SSLtcl-0.42/SSLtcl-0.42.tar.gz
 Description: SSLtcl is a free, loadable module for Tcl that
        extends the socket command with SSL (secure socket layer)
        functions.  It is a thin layer over Eric Young's free
        SSLeay.  Be sure to carefully research the import and
        export restrictions of your country before fetching and
        building this package.  It requires Tcl 8 and either
        SSLeay-0.6.6 or SSleay-0.8.1.
 Updated: 10/1999
 Contact: mailto:[email protected] (Peter Antman)

 ----

 What: Tcl IPC interface
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/alcatel/extensions/tclipc1-0.tar.gz
 Description: Implements Tk's send command without requiring Tk or X11.
 Updated:
 Contact: mailto:[email protected] (Kim Gillies)

 What: [TCL-DP]
 Where: http://tcldp.sourceforge.net (maintained)
        http://www.cs.cornell.edu/Info/Projects/zeno/Projects/Tcl-DP.html (older, original site)
        ftp://ftp.cs.cornell.edu/pub/tcl-dp/current/
        ftp://ftp.cs.cornell.edu/pub/tcl-dp/4.0b2/NOTICE
        ftp://ftp.cpsc.ucalgary.ca/pub/users/roseman/tcl-dp-0.2.sit.hqx
 Description: Tcl Distributed Programming - a public domain extension
        which adds TCP/IP connection management, remote
        procedure call and distributed object protocols to Tcl/Tk.
        Tcl-DP 4.0 is now dynamically loadable for Tcl 7.6 that adds support
        for TCP, UDP, IPM, serial ports, email as well as the ability to
        perform RPCs over any channel.  It has been tested on
        SunOS 4.1.3, Solaris 2.5, Linux 2.0.29, HP-UX 9.05, Windows NT 4.0,
        and Windows 95.
        The roseman file is an alpha port of Tcl-DP to PowerMac.
 Updated: 08/2010
 Contact: mailto:[email protected]
        mailto:[email protected] or
        mailto:[email protected]
        mailto:[email protected]

 What: Tcl-DP with caller id
 Where: From the contact
 Description: A modification of rpc.tcl to call the in.indentd process to
        see who is making a request.
 Updated:
 Contact: mailto:[email protected] (Tom Sandholm)

 What: Tcl-DP with Multicast IP
 Where: ftp://agate.lut.ac.uk/pub/mbone/tdpm3.2.tar.Z
 Description: A version of Tcl-DP 3.2 which is patched to include
        support for multicast IP communications.  It also has an early
        prototype of a late-binding RPC system.
 Updated:
 Contact: mailto:[email protected] (Jon P. Knight)

 What: Tcl RPC (Shorter)
 Where: ftp://ftp.globalware.com/pub/tcl/tcl-RPC-1.3.0.tar.gz
 Description: Provides an RPC interface on top of Tcl 7.5's socket command.
        This provides some level of replacement for Tcl-DP 3.3b1.
 Updated:
 Contact: mailto:[email protected] (Michael E Shorter)

 What: Tcl-RPC
 Where: http://www.zveno.com/zm.cgi/in-tclxml/in-xmlrpc.tml
 Description: A new Tcl 8.1.1 package that implements the XML-RPC
        protocol for both client and server.  This package may be
        able to be downgraded to earlier versions of Tcl if necessary.
        This package includes an interface to the Tcl web server (tcl-httpd)
        which results in a nice embeddable version of an XML-RPC server.
        Minimal documentation is currently available.
        A mailing list is available - see the web site for details.
 Updated: 06/1999
 Contact: mailto:[email protected]

 What: Tcl UDP extension
 Where: http://sourceforge.net/projects/tcludp/
        http://www1.cs.columbia.edu/~xiaotaow/main/index.htm
 Description: The Tcl UDP extension provides a simple library to support UDP
        sockets in Tcl. Supports TCL 8.4 and newer on UNIX and Windows.
 Updated: 08/2010
 Contact: [email protected] (Xiaotao Wu)

 What: Tcl UDP
 Where: From the contact
 Description: Tcl extended to support UDP sockets as an extension.
        Contact considering extending this into a dynamically loadable
        extension for full socket functionality, so that sockets need not
        be in the core.
 Updated: 12/1998
 Contact: mailto:[email protected] (Sami Khoury)

 What: TclDii
 Where: http://www.cerc.wvu.edu/dice/iss/TclDii.html
 Description: Integration of Tcl with IONA's Orbix ORB.
        This is a Tcl front-end to the CORBA Dynamic Invocation Interface,
        extending Tcl so that scripts can send CORBA service requests.
 Updated:
 Contact: mailto:[email protected] (Bernhard Merkle)

 What: tcliop
 Where: http://cybermarche.dmssoft.com/%7Ealmasi/tcliop/mapping.htm
 Description: CORBA 2.0/IIOP extension for Tcl.
 Updated: 12/1996
 Contact: mailto:[email protected]

 ----

 What: TclIR
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/tclIR-0.9.tar.gz
 Description: An extension to add CORBA calls (via Dynamic Invocation
        Interface with the help of the Interface Repository).  Uses
        Orbix CORBA client library.  Written in C++.  Tested on
        Solaris 2.4 with OrbixMT 1.3.4.
 Updated: 10/1998
 Contact: mailto:[email protected]

 What: tclRawTCP
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/tclRawTCP.shar.gz
 Description: Raw TCP package for Tcl/Tk based on tcpConnect.
 Updated: 10/1998
 Contact: mailto:[email protected] (Vivek Khera)

 ----

 What: tclSSL
 Where: http://www.bringardner.com/tony/tclssl.tar.gz
        http://www.psy.uq.oz.au/%7Eftp/Crypto/
 Description: Tcl dynamic load package that provides an interface to
        Eric Young's mailto:[email protected] implementation of
        SSL and supporting libraries with Tcl to provide SSL
        protection to sockets. SSL capability is added to the socket
        with a -ssl option.
 Updated: 10/1999
 Contact: mailto:[email protected] (Tony Bringardner)

 What: tclTCP
 Where: ftp://ftp.atd.ucar.edu/pub/vanandel/tclTCP2.2.tar.gz
        ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/tclTCP2.2.tar.gz
 Description: Tcl 7.[45] based BSD socket library extension.  Allows Tcl/Tk
        applications to communicate without using Tk's "send" command.
        It does not require patching the Tcl or Tk sources and does not
        require Tk or X.  It provides a simple event handling
        capability for Tcl applications to handle file I/O and "whenIdle" calls.
        Note that non-Tcl applications can send commands to a Tcl interpreter
        via a socket if the Tcl application uses tclTCP.
 Updated: 10/1998
 Contact: mailto:[email protected] (Joe VanAndel)

 What: tclTCP+
 Where: ftp://ftp.wag.caltech.edu/pub/kis/bin/tclTCP+1.1.tar.gz
        ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/tclTCP+1.1.tar.gz
 Description: Adds inetd, timer, fork, nowait and other commands to tclTCP.
 Updated: 10/1998
 Contact: mailto:[email protected]

 What: TclUdp (Bornmann)
 Where: http://www.cs.uoregon.edu/%7Echrisbo/udp/ (???)
        ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/comm/tcludp-1.1/tcludp-1.1.tar.gz
        http://www.cs.tamu.edu/people/mmiller/tcl/
 Description: Extension to Tcl 7.5 to provide access to UDP sockets. Available
        for Unix and Windows.
        More about tcludp at tamu.
 Updated: 12/1998
 Contact: mailto:[email protected] (Christopher Brendan Bornmann)

 What: tcludp (Miller)
 Where: http://www.cs.tamu.edu/people/mmiller/tcl/
 Description: Extension to add text based UDP datagrams to Tcl 7.6 or 8.0.
        Works with Tcl on Solaris, OSF1, Linux, and SCO Unix.
 Updated: 10/1999
 Contact: mailto:[email protected]

 What: tclXtsend
 Where: ftp://ftp.x.org/contrib/libraries/tclXtSend.1.0.tar.Z
        ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/tclXtSend.2.0.tar.gz
 Description: Allow Xt applications to send msgs to Tk applications.  Version
        1.0 works with Tk 3.x and version 2.0 works with Tk 4.x.
 Updated: 11/1998
 Contact: mailto:[email protected] (Jan Newmarch)

 What: tcpConnect
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/tcpConnect.shar.gz
 Description: Tcl/Tk TCP extensions
 Updated: 10/1998
 Contact: mailto:[email protected] (Pekka Nikander)

 What: Tk send reliability enhancement
 Where: From the contact
 Description: A wrapper for Tk's send to provide a more reliable RPC
        mechanism.  Most importantly, the typical timeout of the send is
        avoided.  It is called rpc.tcl and should soon show up on archives.
 Updated:
 Contact: mailto:[email protected] (Robert LoVerso)

 What: Tk without X (beta)
 Where: ftp://toe.cs.berkeley.edu/pub/multimedia/misc/tknx0.3.tar.Z
 Description: A version of Tk without the X dependent code.  Allows the
        construction of programs using send, after and a few of the
        other non-X specific commands.  Useful to use with Tcl-DP.
 Updated:
 Contact: mailto:[email protected] (Brian Smith)

 What: Tkpvm
 Where: http://www.cogsci.kun.nl/tkpvm/welcome.html
        ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/packages-7.6/devel/tkpvm1.1.tar.gz
        http://www.netlib.org/pvm3/pvm3.3.11.tar.gz
        http://www.epm.ornl.gov/pvm/.
 Description: An interface between a parallel virtual machine library
        and Tcl/Tk.  Treats a number of machines as if they were really a
        single machine.  Also has an enhanced capability to communicate
        between processes.  Each process in the virtual machine communicates
        through a pvm-channel based send command rather than Tk's X11
        based send command.  Supported only on Tcl 7.6plus (or Itcl 2.1),
        Tk 4.2plus, and PVM 3.3.x.
        Tkpvm does not yet work with Tcl 8.0 or PVM3.4.
 Updated: 10/1998
 Contact: mailto:[email protected] (Jan Nijtmans)

 What: TLS
 Where: http://www.sensus.org/tcl/
        http://www.openssl.org/
 Description: OpenSSL extension for Tcl, utilizing any standard Tcl
        bi-directional channel (not just sockets).  Requires Tcl 8.x,
        Trf core patch.  Runs under Win32 and Unix.
        Currently at version 1.3.
 Updated: 06/2000
 Contact: mailto:[email protected] (Matt Newman)

 What: Torb
 Where: http://pythontech.co.uk/torb/
 Description: Alpha release of Tcl/CORBA interface, allowing CORBA
        operations to be invoked from Tcl applications.  Potentially works
        with any ORB which supports the standard C language mapping, though
        initially only ORBit is supported.
 Updated: 06/1999
 Contact: mailto:[email protected] (Colin Hogben)

 ----

 What: TxRx
 Where: http://se.aminet.net/pub/lang/tcl/sorted/net/txrx1.0/txrx1.0.tar.gz
        http://www.usenix.org/publications/library/proceedings/tcl97/full_papers/poster_mata/mata_html/txrx.html
 Description: Dynamically loadable package that enables Tcl programs to
        call or service Remote Procedure Calls (RPC).  Complies with
        RFC 1831.  This helps in the development of distributed applications
        compatible with ONC RPC.  With TxRX, it becomes possible to
        write a WebNFS client and server in Tcl.
 Updated: 09/2006
 Contact: mailto:[email protected] (Cristian Mata) ???

 What: Unix-domain sockets  
 Where: http://gpu.utcc/%7Epkern/tcl-socket/  (broken link)  - probably now here: http://utcc.utoronto.ca/~pkern/tcl-socket/
 Description: primitive attempt to enhance tcl socket command to
        use both unix domain (filename) as well as network sockets.
 Updated: 10/1999
 Contact: mailto:[email protected] (Paul Kern)

 What: X.25 sockets
 Where: ftp://ftp.tcl.tk/pub/tcl/mirror/ftp.procplace.com/sorted/comm/x25tcl/0.1.0/
 Description: Tcl package to access X.25 sockets in the form
        of a Tcl_Channel.
 Updated: 07/1999
 Contact: mailto:[email protected] (D. J. Hagberg)

voominc - 2010-08-10 18:53:49

The Tcl-DP extension supports remote process communication. It also has a C-API that allows a non-Tcl client to connect to a Tcl-DP server. I have updated Tcl-DP to work with Tcl 8.5, current Linux versions (Fedora 11) and Windows XP.