diff --git a/doc/xschem_man/xschem_remote.html b/doc/xschem_man/xschem_remote.html index b7494e9e..f9a1d8d2 100644 --- a/doc/xschem_man/xschem_remote.html +++ b/doc/xschem_man/xschem_remote.html @@ -23,7 +23,7 @@ p{padding: 15px 30px 10px;}
XSCHEM embeds a tcl shell, when running xschem the terminal will present a tcl prompt allowing to - send / get commands through it. + send commands through it. Most user actions done in the drawing window can be done by sending tcl commands through the tcl shell. A tcp socket can be activated to allow sending remote commands to xschem, for this to work you must the xschem_listen_port tcl variable in xschemrc, specifying an unused port number. @@ -39,6 +39,49 @@ p{padding: 15px 30px 10px;} This command: 'puts $XSCHEM_LIBRARY_PATH' will print the content of the XSCHEM_LIBRARY_PATH tcl variable containing the search path.
+ + +
+ Since the same TCP port can not be used in more than one process a mechanism is provided to handle multiple
+ xschem processes.
+ A setup_tcp_xschem <port> command is provided to set up another TCP port xschem will listen to,
+ freeing the initial port number set in the xschem_listen_port TCL variable, in the xschemrc
+ configuration file.
+
+ In all cases the xschem_listen_port returns the new port number that will be used and set the global
+ xschem_listen_port variable accordingly.
+ The following shell script fragment shows the commands to be used to negotiate with xschem another tcp port.
+ The nc (netcat) utility is used to pipe the commands to the tcp socket.
+ When starting xschem a fixed initial port number is always used (2021 by default), so it is always possible to
+ remotely communicate with xschem using this TCP port. Then the following comands can be sent to setup a new port number
+ for further communications, freeing the initial (2021) potr number. If another xschem process is started it will
+ again use the initial port number, so no port number collisions occur.
+
+# start an xschem instance in background +schippes@asus:~$ xschem -b & +[1] 9342 +# negotiate a new port number instead of default 2021 +schippes@asus:~$ a=$(echo 'setup_tcp_xschem 0' |nc localhost 2021) +schippes@asus:~$ echo "$a" +34279 +# Send a command using the new port number +schippes@asus:~$ b=$(echo 'xschem get current_name' |nc localhost "$a") +schippes@asus:~$ echo "$b" +untitled.sch + +## repeat above steps if you want additional xschem instances each listenng to a different free tcp port. + ++ +