From: Yohanes Santoso Date: 2005-12-17T11:06:26+09:00 Subject: Re: nonblocking TCPSocket in multithread software. Arto Pastinen writes: > Hi! > > Why this blocks? > > a = Thread.new do > s = TCPSocket.new('localhost', 4343) > s.nonblock = true > p s.read # it block's here no matter what i do I expect it to block. All IO's buffered I/O methods (puts, prints, read, write, etc.) are blocking operations. The utility of nonblock comes if you use unbuffered I/O methods: sysread, syswrite, recv, send, etc. YS. > end > a.join > > .. and how to make it nonblock? > > It works fine if i drive it in main thread. > > Thnx: Artsi