The docs for ns_sockcallback has this example:

set sock [ns_socklisten * 9000]
ns_sockcallback $sock newconn r

# Keep $sock from closing after connection ends
detach $sock

# When a connection arrives, newconn will be called as:
# newconn $sock r

proc newconn {sock when} {
    set fds [ns_sockaccept $sock]
    set rfd [lindex $fds 0]
    set wfd [lindex $fds 1]
    puts $wfd "Hello!"
    close $rfd
    close $wfd
}

'detach' doesn't seem to be a tcl command anymore,
how can I keep a sock from closing now?

--Tom Jackson

Reply via email to