From: "Mauricio Fernández" Date: 2003-02-27T17:24:17+09:00 Subject: Re: Unable to do non-blocking read on socket 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... -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Why use Windows when you can have air conditioning? Why use Windows, when you can leave through the door? -- Konrad Blum