From: Seth Kurtzberg Date: 2003-03-03T03:47:39+09:00 Subject: Re: Unable to do non-blocking read on socket On Sunday 02 March 2003 11:16 am, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Unable to do non-blocking read on socket" > > on 03/03/03, Seth Kurtzberg writes: > |Yes, I know, but what I said is the reverse. It blocks when you _do_ > | supply the maximum read size, not when you don't. > > I think I'm confusing. Let me check the source again.... > > OK. Now I understand my code better: > > (a) IO#read (without size) returns all available data on the IO. > It doesn't block if O_NONBLOCK is set. I was wrong in > [ruby-talk:66149]. Not what I would like to see but not what I was trying to use. > > (b) IO#read (with maximum size) raise an EWOULDBLOCK exception if the > buffer is empty. It returns the buffer contents if the buffer is > partially filled before EWOULDBLOCK. It never returns EWOULDBLOCK. Unless the buffer is empty at the time of the call, it blocks until the maximum number of bytes (as specified by the parameter) is received. So, both variations block, and NONBLOCK behavior is not available with either. > > I'm not sure you're complaining to which behavior (or both). > > matz. -- Seth Kurtzberg M. I. S. Corp. 480-661-1849 seth@cql.com