From: schristensen@daimi.aau.dk (Soren Christensen) To: designCPN@daimi.aau.dk Date: Mon, 22 Jul 1996 10:11:17 +0200 Subject: Re: Possibility to communicate with a running Unix-process? The example of communication to a Tcl/Tk script added by Kjeld is definitely more convincing than my file handling. It is a little more demanding than my sub-process, since it needs information on which X-server to use, and thus you should change the way the sub_process is started. Replace the contents of the global declaration node with the following: color E = with e; globref to_prc = IO.std_out; globref from_prc = std_in; (* change path to fit your filesystem *) fun start_process () = let val (x,y) = execute_in_env("/sub_process.tcl",[], ["DISPLAY=:0.0"]); in to_prc := y; from_prc := x end; fun send (n:int) = (IO.output(!to_prc,(makestring n)^"\n"); IO.flush_out (!to_prc)); exception Comm_Err; fun check_response () = case input (!from_prc,2) of "1\n" => () | _ => raise Comm_Err; Remember to specify full path and display host in the source code above. This should take care of Kjeld's problem with the cpnmld daemon... Regards, Soren > Additionally to Soren's example, I've included an example where the > external executable communicated with is a Tcl/Tk script. In the global > declaration node, change the execute file path to point to the Tcl/Tk > script sub_process.tcl. > > (If you do not see any graphical feedback when simulating the model, > please start manually a cpnmld daemon with a new port number. I do > not know why this is necessary, but at least it works for me.) --------------------------------------------------------------------- | Soren Christensen, Computer Science Department, Aarhus University | | Ny Munkegade 116, DK-8000 Aarhus C, DENMARK | | email: schristensen@daimi.aau.dk | phone: +45 89 42 32 65 | | telefax: +45 89 42 32 55 | phone at home: +45 86 93 63 26 | | WWW URL: | --------------------------------------------------------------------- --- [[ Post messages and summary of replies: designCPN@daimi.aau.dk ]] [[ To (un)subscribe, send "help" to: Majordomo@daimi.aau.dk ]] [[ The moderator's address: designCPN-owner@daimi.aau.dk ]] [[ World Wide Web URL: http://www.daimi.aau.dk/designCPN/email/ ]]