Tcl in the Middle

Michael Cleverly

Tcl has long been recognized as an excellent language to glue existing components together to create new applications. Tcl is just as useful when interjected into the middle of existing/functioning N-tier "enterprise" systems.

SockSpy is probably the best known example of a "main in the middle" Tcl application. What may not be as widely appreciated, however, is that Tcl's strong TCP sockets and event-driven I/O make construction of custom man in the middle solutions (that solve real business problems often at a fraction of the cost of other potential solutions) quite straightforward (even more so with the new [chan] command in Tcl 8.5).


"Tcl in the Middle" draws from the author's experience implementing TIP #287, from a half-dozen custom "man in the middle" applications created for Intermountain Healthcare, and from the author's own OSS projects. These applications include:

Load balancing, SSL termination, source NAT'ing, content inspection are all features of hardware devices from major vendors whose costs and complexities far exceed the affordableness and nimbleness of smartly deployed Tcl solutions.