From: Alex McHale Date: 2001-03-07T06:11:50+09:00 Subject: [ruby-talk:12181] Re: Nonblocking Read This is what I had initially seen - but in my tests, it still *seems* to be blocking. For example (this is not what will be the end product, this is a simple conversion of my current code to sysread, dysfunctional as it is). Thread.start do print "Beginning\n" while player.connected and (incomm = player.socket.sysread 1) print "Inside loop\n" incomm.chop! player.inbuff= incomm sleep 0.1 print "Done with loop\n" end print "Ending\n" end As I understand, if sysread does not block; once a user is connected, it should either print the "Inside loop" and "Done with loop" over and over *Or* bail immediately for lack of incoming data. It does neither. It processes incoming data exactly (except for the amount of data being dealt with, 1 byte versus 1 line) as though I still used readline. Am I totally missing something here? Thanks, Alex McHale On Wed, Mar 07, 2001 at 05:45:14AM +0900, GOTO Kentaro wrote: > In message "[ruby-talk:12174] Nonblocking Read" > on 01/03/07, Alex McHale writes: > > I was just wondering if there is a way to do a non-blocking read on a > >TCPSocket object. > > IO#sysread is what you are looking for. > > -- Gotoken