
set port [lindex $argv 0]

proc Ok {sock} {
    puts $sock\ writable
    puts eof\ [eof $sock]
    puts er?\ [fconfigure $sock -error]
    close $sock
    set ::forever reached-the-end-of-time
    return
}


set s [socket -async localhost $port]
fileevent $s writable [list Ok $s]

puts waiting
vwait forever

