From: Seth Kurtzberg Date: 2003-02-27T17:27:26+09:00 Subject: Re: Unable to do non-blocking read on socket The read call is already preceded by kernel#select(), but that doesn't help. kernel#select() tells me that data is available to read, but it doesn't stop IO#read() from blocking if it's buffer size is larger than the amount of data available to read. On Thursday 27 February 2003 01:24 am, Mauricio Fern�ndez wrote: > On Thu, Feb 27, 2003 at 05:03:37PM +0900, Seth Kurtzberg wrote: > > I have not been able to change the behavior of IO::read() to > > non-blocking. Calling the fcntl method and setting the NONBLOCK flag > > (and/or the NDELAY flag) has no effect on the behavior of IO::read(). > > > > This is on a socket. IO::recv() does not block; however, I can't use > > IO::recv() because I have already used a buffered read method on the file > > descriptor. This causes an exception, not just the unpredictable > > behavior suggested in the documentation. > > > > More precisely, if running with the debugger, an exception occurs stating > > that a previous buffered read has occured on the stream. If running > > normally (without the debugger) an exception occurs stating "wrong number > > of arguments (5 for 4)" during the IO#read() call, which is odd as the > > method takes only one parameter and a second optional parameter. > > Presumably the exception occurs somewhere down the stack; as the method > > name is not displayed and the behavior changes if the debugger is used, > > it is rather difficult to know what is going on. > > > > In any event I need to be able to do a read that doesn't block. > > Kernel.select ? > Not really what you're asking for, but... -- Seth Kurtzberg M. I. S. Corp. 480-661-1849 seth@cql.com