Re: Socket Infinitely Readable, Not EOF



forget all that.

why did you set buffering to none?

can you reproduce your problem with this script?:
#!/usr/bin/tclsh
set ::buffersize 50 ;# change for testing
set ::read 0
set ::eof 0
proc myacceptsock {sock args} {
        fconfigure $sock -encoding binary -translation binary
	# change for testing
        fconfigure $sock -buffering full -buffersize $::buffersize
        fconfigure $sock -blocking 0
        fileevent $sock readable [list mysockread $sock]
}
proc mysockread sock {
        set start [clock clicks ]
        if {[eof $sock]} {
                close $sock
                set ::eof 1
                return
        }
        set buffer [ read $sock $::buffersize ]
        set length [ string length $buffer ]
        incr ::read $length
        set stop [clock clicks ] ;# check if the read blocked
        puts stderr "READ:$::read  $length [expr {$stop - $start}]"

}
socket -server myacceptsock 21000

vwait ::eof
puts isEOF
#end

use something like (assuming bash as the shell )
while true ; do cat mytestdatablock.dat ; sleep 1 ; done >/dev/tcp/<sink-host>/21000

fill mytestdatablock.dat with some random data to your liking

uwe

.



Relevant Pages

  • Re: Tcl UDP Server vs Python UDP server, not good....
    ... Also changing the server reply to a puts to stdio, seems to suggest that the call-back sendTime is being invoked twice for each message received from client. ... proc sendTime {sock} { ... set peer [fconfigure $sock -peer] ...
    (comp.lang.tcl)
  • using ipfw seems to interfere with socket communication
    ... After I added the following rules to my ipfw configuration: ... ipfw pipe 1 config bw 2000000000Mbit/s ... set sock "" ... fconfigure $sock -blocking 0 ...
    (freebsd-net)
  • Re: Who maintains Tclhttpd?
    ... puts $sock $message ... Log $sock LostSocket $data$err ... It sounds like the fconfigure probably is right. ...
    (comp.lang.tcl)
  • Re: channels and null end of messages
    ... proc blow {sock line} ... I keep a string buffer for the channel (omitting timeout ... set fblock [fconfigure $sock -blocking] ...
    (comp.lang.tcl)