

proc doit {{count 1} {max 10}} {


        puts stdout "$count -- start CLIENT "
        socket localhost 4444


        if {$count == $max} {
            after 3000 {set ::forever 0}
            return
        }

        incr count
        after idle [list doit $count $max]
        #doit $count $max
}

set connection_count 0
proc connect {args} {
    incr ::connection_count
    puts stdout "$::connection_count -- SERVER -- connect from  $args"
}


socket -server connect 4444
after idle doit

vwait forever

puts stdout "total connections:  $connection_count"




