title: Hanging Window When Using TCL Sockets
body: <p>I am using TCL socket command to communicate between two TCL/Tk applications say A and B where both have a associated GUI. The server on B basically accepts commands from A and returns the result of the execution. The problem is that the GUI for B hangs as soon as the execution is completed. Is there a way to enable the two GUI's to work independently? I am using the following scripts to setup the connection between the two applications:</p>
  
  <p>Start application A with the following TCL script client.tcl</p>
  
  <pre><code>proc execute { cmd } {
      set cid [socket localhost 9900]
      puts $cid $cmd
      while { [gets $cid line] &gt;= 0 } {
          puts $line
      } 
      close $cid
  }
  
  set pid [exec B server.tcl &amp;]
  
  execute {puts HelloWorld}
  </code></pre>
  
  <p>where server.tcl sets up the server through application B</p>
  
  <pre><code>proc server { cid addr port } {
       set cmd [gets $cid]
       catch $cmd result
       puts $cid result
       close $cid
  }
  
  socket -server server 9900
  
  vwait forever
  </code></pre>
  
  <p>The goal is to let the GUI for B be active while user continues to work with GUI for A. That way the user can switch between the two GUI's on a need basis. Both A and B provide different functionality for working with the same data which need to be made available at the same time.</p>