[ Previous ] [ Contents ] [ Index ] [ Next ]

ns_sockaccept

Overview

Accept a new socket connection

Syntax

ns_sockaccept sockid

Description

ns_sockaccept accepts a new connection pending on sockid.

Example

    #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

ns_sockcallback

ns_socklisten

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.