It looks like ns_socklistencallback closes the socket when the proc returns. I tried the following code:
proc echo_server {fdString} { ns_log notice "A client has connected to the socket at [ns_time]" set fdList [split $fdString ","] set rfd [lindex $fdList 0] set wfd [lindex $fdList 1] while {[set line [string trim [gets $rfd]]] != ""} { puts $wfd $line flush $wfd } close $rfd close $wfd } proc echo_server_improved {rfd wfd} { ns_log Notice "Client connecting to improved echo server" ns_schedule_proc -once -thread 0 echo_server ${rfd},${wfd} } ns_socklistencallback 216.254.26.186 7777 echo_server_improved But I got the following error: [27/Nov/2002:16:36:23][2682.3076][-socks-] Notice: Client connecting to improved echo server [27/Nov/2002:16:36:23][2682.5126][-sched:19-] Notice: A client has connected to the socket at 1038443783 [27/Nov/2002:16:36:23][2682.5126][-sched:19-] Error: can not find channel named "sock6" So it looks useless for your intended purpose, at least using a scheduled proc. --Tom Jackson