Communicating with Tcl applications
Often, our application needs to be able to accept commands from a local and/or remote application or troubleshooting utility. In many cases it is enough to set up a service that will accept connections and evaluate commands sent over them.
We can do this by using the comm
package that offers both client and server functionality. This package allows many use cases from a simple server that evaluates all commands to a system that allows only certain tasks to be performed. This package uses TCP connections so it is possible to handle both local and remote connections. However, it is configurable whether connections from other computers are allowed.
Using a comm
package we can also connect to our application from applications such as TclDevKit inspector from ActiveState, which can help in troubleshooting daemon-like applications. This is described in more detail in chapter 4.
Comm client and server
Using the comm
protocol requires the use of the comm::comm
...