Overview: tclTCP is a library that allows TCL based applications to communicate via TCP/IP, without using Tk's "send" command. tclTCP is an extension to Tk/TCL, and does not require patching the TCL or Tk sources. In contrast to tcl-dp, tclTCP does NOT require Tk and X. As part of its implementation, tclTCP provides a simple event handling capability for TCL applications to handle file I/O and "whenIdle" calls. (It does not provide timer handling.) Note that non-TCL applications can send commands to a TCL interpreter via a socket if the TCL application uses tclTCP. TCP/IP clients and servers for TCL -- Installation Instructions Files on this tape: README - This file Makefile.noimake - Makefile for the TCL-TCP/IP interface Imakefile - for use with imake (xmkmf) simple.c - Test program for the TCP/IP interface src/Makefile.noimake - Makefile for the TCL-TCP/IP interface src/tclTCP.c - Source code to the TCP/IP interface src/tclTCP.h - Header file describing the TCP/IP interface src/simpleEvent.c - event handling for non-TK programs src/svrStrmSock.c - server side of TCP socket utilities src/clntStrmSock.c - client side of TCP socket utilities src/readFullBuf.c - tcp/ip utility src/tcltcp_init.c - contains initializion functions for this package. tcp.man - Man page for the TCP/IP interface demos - Subdirectory containing a set of demonstration programs. Instructions: - Unpack this package, preferably under the same parent directory that contains your TCL and TK distributions. Create symbolic links in the parent directory for your TCL and Tk directories, like: % ln -s tcl7.3 tcl % ln -s tk3.5 tk - If you have "imake", edit Imakefile, setting TCL_INCDIR and TK_INCDIR and build your makefile, using the following steps; % xmkmf % make Makefiles % make This is the preferred solution, since it builds shared libraries for tclTCP. - Otherwise, % cp Makefile.noimake Makefile % cp src/Makefile.noimake src/Makefile Edit as necessary for your system. If you need to use a -I option for cc to find and , add it to the CFLAGS= line. If you need a -L option for the loader to find libtcl.a and libtk.a, add it to the LDFLAGS= line. - Type `make' to make the whole package. - For a simple test of the server interface, type `./simple&'. This command will start a Tcl interpreter running as a server in the background. You can connect to the server by typing `telnet localhost 2323'. You can type Tcl commands to the background server, and type the command, `bye' when you are done playing with it. - A broader set of demos is contained in the `demos' subdirectory. To try them, cd to the `demos' subdirectory and type the command: dodemo This will start a server in the background that contains a simple Tcl program that maintains a color, along with a few clients that show the color value and let you change the value. Try changing the color using `entries', or `colortab', and notice that all the other views change in synchrony. (By the way, note also that you can have multiple copies of the various clients in execution at once.) When you're done, hit the `Quit' button on each client and the server. - You're now ready to add the TCP/IP support to your own Tcl applications. Look at simple.c and tkAppInit.c for the Tcl_AddCommand call that installs the TCP support in the interpreter. It's that simple. Note that libtclTCP.a is provided for TCL only applications, while libtkTCP.a is provided for TCL/Tk applications. Please direct correspondence on this package to Kevin Kenny, KennyKB@CRD.GE.COM (the original author) or Joe VanAndel (vanandel@ncar.ucar.edu) who ported it to TCL7.3, Tk3.6 Changes in RELEASE 2.0 Port to TCL 7.X . Because of differences in TCL utility routines between TCL 6.X and TCL 7.X, applications using tclTCP1.0 do not communicate well with applications using tclTCP2.0 CHANGES IN RELEASE 1.0 Several changes have been made here and there to enhance portability. The package is now known to work on - Decstation 3000 and 5000 series running Ultrix. - VAX running ULTRIX. - Sun 3 and Sun 4 (Sparcstation and equivalents) under SunOS. - Hewlett-Packard 9000 Series 300. Event management has been split into a file called simpleEvent.c, separate from the TCP-specific code. Support for Xt's main event loop has been added to the event management. The man pages have been greatly expanded and updated. The demos have been updated to run correctly with tk 2.0 and 2.1. A few debugging print statements have been removed. Bug fixes: - A server process no longer aborts if a server is closed before all its clients have been closed. THis also avoids an intermittent behavior where a process would abort rather than terminating in response to `destroy .'. - Closing a connection from the server end with `$connection close' no longer causes SIGPIPE. This was a problem only on some varieties of UN*X. - The default `trusted host' check is more forgiving of unusual system configurations. - A bug has been fixed in simpleFileSelect that caused hangs in the event loop under certain circumstances. THINGS TO DO FOR THE NEXT RELEASE: - Allow for specifying ports by service name instead of number. - (Maybe) Allow Unix-domain sockets as well as AF_INET. - Allow for servers started by inetd. WARNING: This package has a known deadlock if two tasks send to each other at precisely the same time, since each task will be waiting for a response from the other. This is not a problem if you maintain a "master-slave" relationship, rather than having independent peers, that each can send commands to each other.