Posted to tcl by colin at Sat Nov 17 10:04:40 GMT 2018view pretty
lassign $argv overhead if {$overhead eq ""} { set overhead 3 } try { # calculate o/s max fd limit for Linux lindex [split [exec -- prlimit --output SOFT --nofile] \n] end } on ok {maxfiles} { # works for Linux } on error {e eo} { set maxfiles 1024 ;# I have no idea what value this is for your system } puts stderr maxfiles:$maxfiles set count [llength [chan names]] while {$count < $maxfiles-$overhead} { open [info script] incr count } puts Opened:[llength [chan names]] proc Connected {args} { puts stderr Connected:$args } ::socket -server ::Connected 8091 vwait forever