Here's a piece of test code I've used in the past:

# This proc is run when a connection occurs
proc handle_socklistencallback {rfd wfd} {
    ns_log notice "A client has connected to the socket"
    while {[set line [string trim [gets $rfd]]] != ""} {
        lappend headers $line
    ns_log notice "CLIENT HTTP HEADERS:"
    ns_log notice "$headers"
    set content_htm \
<title>non-ssl test</title>
<p>Great! We were able to do a listen-callback on a socket,
read the client HTTP header and send back this HTML page. Hit the back
button to return to the test page.
<p>Here ar the HTTP client headers you sent me:
    set myheader \
        "HTTP/1.0 200 Document follows
MIME-Version: 1.0
Content-Type: text/html
Content-Length: [string length $content_htm]"
    puts $wfd \

    flush $wfd
    close $rfd
    close $wfd
# This starts the listener on an address and port, and tells it
# what proc to run when a connection comes in
ns_socklistencallback 8443 handle_socklistencallback
Scott S. Goodwin
aim: scottgnet

----- Original Message -----
From: "David Walker" <[EMAIL PROTECTED]>
Sent: Sunday, November 24, 2002 10:23 AM
Subject: [AOLSERVER] ns_socklistencallback

> does anyone have any ns_socklistencallback sample code?

Reply via email to