Posted to tcl by aspect at Thu May 28 11:02:16 GMT 2015view raw
- # on FreeBSD-10.1, this test fails (no error from puts) about 50% of the time
- # on Debian jessie it seems to succeed every time
- # inspired by http://core.tcl.tk/tcllib/tktview?name=ced089d5fe
- set PORT 37465
- set s [socket -server accept $PORT]
- proc accept {chan args} {
- puts "New connection $args"
- puts "Closing $chan"
- close $chan
- }
- set sk [socket localhost $PORT]
- fconfigure $sk -buffering none
- update
- try {
- puts $sk "boom"
- update
- } on error {e eo} {
- puts "PASS: got expected error"
- } on ok {} {
- puts "FAIL: writing to unbuffering, disconnected socket succeeds!"
- }