# -*- tcl -*-
# Client for Tcl bug 219400

set addr [lindex $argv 0] 

## called when data from remote end arrives. 
proc cb {} { 
    variable sock 

    read $sock 

    puts $sock "<callback firstsend>" 
    puts $sock "<callback secondsend>" 

    for {set i 0} {$i < 9000} {incr i} { 
	puts $sock "test32432 test3211 $i" 
    }

    puts $sock "<callback lastnormalsend>" 
    puts $sock "all data ok" 

    close $sock 
    exit 
}

## Open & configure 
variable sock [socket $addr 40010] 
fconfigure $sock -blocking 0 
fconfigure $sock -buffering none 

fileevent $sock r cb 
# cb 

puts $sock "start" 
vwait forever 
