From: "Arto Pastinen" <arto.pastinen / gmail.com> > > http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/158720 > > .. sad .. huoh.. > > > > 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 > > > end > > > a.join > > > > > > .. and how to make it nonblock? My version of Ruby (1.8.2) doesn't have the #nonblock method. So I use: @sock.fcntl(Fcntl::F_SETFL, @sock.fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK) Maybe try: a = Thread.new do s = TCPSocket.new('localhost', 4343) s.fcntl(Fcntl::F_SETFL, s.fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK) print dat while dat = s.recv(65536) end Note that I'm using #recv instead of #read... Maybe this will help? Hope this helps, Regards, Bill