Guillaume Marcais
1/24/2006 6:30:00 AM
Yohanes Santoso wrote:
> Guillaume Marcais <guslist@free.fr> writes:
>
>> So what made the socket suddenly buffered so that #recv becomes
>> illegal? How can I check the buffered status of an IO? Can I revert it
>> from buffered to unbuffered?
>
> You should not mix buffered methods (read, write, puts, etc.) with
> unbuffered methods (sysread, syswrite, recv, recvfrom, etc)
But I don't. There is no call to any of read, write, puts, gets in the
entire app (except for some debugging on stdout with p).
Buffered and unbuffered calls cannot be mixed on a given IO object, but
they can be mixed in the same application, right?
>
> Alternatively, you can use the nonstdio library which redefines the
> various buffered methods in terms of unbuffered methods so you can mix
> the two kinds of IO access.
The download links are broken on the web page.
>
> Note, though, buffered IO is intrinsically blocking operations. It
> does not play nice with multiplexor like Kernel#select.
I am trying to stayed unbuffered and use select. Don't seem to be able
too. Or see why I suddenly switch to buffered.
Guillaume.