Tcl Library Source Code

EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


comm_wire - The comm wire protocol

Table Of Contents


package require comm


The comm command provides an inter-interpreter remote execution facility much like Tk's send(n), except that it uses sockets rather than the X server for the communication path. As a result, comm works with multiple interpreters, works on Windows and Macintosh systems, and provides control over the remote execution path.

This document contains a specification of the various versions of the wire protocol used by comm internally for the communication between its endpoints. It has no relevance to users of comm, only to developers who wish to modify the package, write a compatible facility in a different language, or some other facility based on the same protocol.

Wire Protocol Version 3

Basic Layer

The basic encoding for all data is UTF-8. Because of this binary data, including the NULL character, can be sent over the wire as is, without the need for armoring it.

Basic Message Layer

On top of the Basic Layer we have a message oriented exchange of data. The totality of all characters written to the channel is a Tcl list, with each element a separate message, each itself a list. The messages in the overall list are separated by EOL. Note that EOL characters can occur within the list as well. They can be distinguished from the message-separating EOL by the fact that the data from the beginning up to their location is not a valid Tcl list.

EOL is signaled through the linefeed character, i.e LF, or, hex 0x0a. This is following the unix convention for line-endings.

As a list each message is composed of words. Their meaning depends on when the message was sent in the overall exchange. This is described in the upcoming sections.

Negotiation Messages - Initial Handshake

The command protocol is defined like this:

Script/Command Messages

All messages coming after the initial handshake consist of three words. These are an instruction, a transaction id, and the payload. The valid instructions are shown below. The transaction ids are used by the client to match any incoming replies to the command messages it sent. This means that a server has to copy the transaction id from a command message to the reply it sends for that message.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category comm of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.




comm, communication, ipc, message, remote communication, remote execution, rpc, socket


Programming tools


Copyright © 2005 Docs. Andreas Kupries