Re: Getting working code to work with socket communications



In the example below, the goal is to have
puts "x is $x"
executed UNTIL 'telnet the_host 9900' is done.
Instead, the puts statement is not execute UNLESS
'telnet the_host 9900' is done.


# ---------------------paste example
# Run this in one window, say, on the_host,
# In another window,
#
# The result will show
# Connection from the_host registered
# every time 'telnet the_host 9900' is done.
#
global do_the_action
set do_the_action 0


proc Server {channel clientaddr clientport} {
global do_the_action

puts "Connection from $clientaddr registered"
puts "10: do_the_action is $do_the_action"
close $channel

set do_the_action 1

}

socket -server Server 9900

vwait do_the_action
puts "20: do_the_action is $do_the_action"

# Unfortnately, the code execution never gets past here. This
# simulates the real, working section of the code, and is in reality
# well over a hundred thousand lines long.

for {set x 0} {$x<10} {incr x} {
puts "x is $x"
after 1000
if { $do_the_action } { break; }
}

#--------------------- end paste example

.



Relevant Pages

  • Re: telnet issue
    ... proc telnetLogin {user passwd prompt} { ... {puts "FAIL\nTelnet login prompt for $user never happened\n" ... puts "telneting to switch" ... spawn telnet $switch ...
    (comp.lang.tcl)
  • Re: telnet issue
    ... {puts "FAIL\nTelnet login prompt for $user never happened\n" ... puts "telneting to switch" ... spawn telnet $switch ...
    (comp.lang.tcl)
  • Re: how to view net http get response for a web spider tutorial
    ... I need some help running parse_journal.rb from parse_user.rb: ... puts watch_for ... f.puts %x[ruby parse_journal.rb #{friend} #] ... should execute right away. ...
    (comp.lang.ruby)
  • Re: function like "function_exits"
    ... def foo() ... puts function?=> true ... And I'm glad you like ruby! ... So the way to check if an object can execute code with a certain name ...
    (comp.lang.ruby)
  • ActiveTcl 8.4.12 Expect for Windows script conversion problem
    ... Windows telnet client or the script itself? ... puts "\nTimeout in user login\n" ... Telica Plexus 9000 1999-2003 Telica Inc. ...
    (comp.lang.tcl)