Chapter 6 Remote Tcl Interface
This chapter describes the remote Tcl interface, which allows a separate
external Tcl program to interact with ECLiPSe in much the same fashion as
the embedding Tcl interface (see chapter 5). Like the embedding
interface, Tcl and ECLiPSe code communicates by sending and receiving
streams of bytes via I/O queues (the ec_rpc mechanism is
implemented on top of these queues).
The interface can thus be
used in similar fashion to the embedding interface, e.g. for the
development of graphical user interfaces to an ECLiPSe application, with the
difference that the ECLiPSe program is a separate program and not
embedded into the Tcl program.
The main features of the interface are:
-
The connection between the Tcl and ECLiPSe processes are established
via sockets using TCP network protocol. Thus the Tcl process can be run on
a different machine and platform from the ECLiPSe process.
- The Tcl process can be attached to any running ECLiPSe process,
including an ECLiPSe embedded into another host language.
- More than one Tcl (or other remote) process can be attached to a
single ECLiPSe via the remote interface.
- For the programmer, the embedding and remote interfaces are largely
similar, and once the connection is established in the remote interface,
the same code on the ECLiPSe and Tcl sides can be used for both interfaces.
The remote interface thus offers more flexibility than an embedding
interface in how the Tcl code can be connected to an ECLiPSe
program. However, as the Tcl and ECLiPSe processes are not as tightly
coupled as in an embedded interface, the speed of communications between
the Tcl and ECLiPSe processes is likely to be slower.
- 1
- The ECLiPSe side may be more complicated than a simple ECLiPSe, as it can be
an embedded ECLiPSe, or the ECLiPSe process and other attached remote
processes.
- 2
- Instead of remote_connect/3, the more
flexible remote_connect_setup/3 and remote_connect_accept/6
pair of predicates can be used. See the reference manual entries for these predicates for more
details.
- 3
- See
section 5.8 for more on EXDR format
- 4
- For compatibility with previous
versions of the embedded Tcl interface, the mode can also be
specified as r (equivalent to fromec) or w (equivalent to
toec). These can be somewhat confusing as read/write status depends
on from which side the queue is viewed (a read queue in ECLiPSe is a
write queue in Tcl).