NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_sockaccept(n) 4.99.19 naviserver "NaviServer Built-in Commands"

Name

ns_sockaccept - Accept a new socket connection

Table Of Contents

Synopsis

Description

ns_sockaccept accepts a new connection pending on sockid.

COMMANDS

ns_sockaccept sockid

EXAMPLES

#listen for connections on port 9000
set sock [ns_socklisten * 9000]
#wait for new connection
set fds [ns_sockaccept $sock]
set rfd [lindex $fds 0]
set wfd [lindex $fds 1]
puts $wfd "Hello!"
close $rfd
close $wfd
close $sock

See Also

nsd

Keywords

NaviServer, accept, global built-in, socket