[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Q] NSFileHandle -readDataOfLength behaviour
From: |
Vaisburd, Haim |
Subject: |
RE: [Q] NSFileHandle -readDataOfLength behaviour |
Date: |
Mon, 16 Apr 2007 10:41:39 -0700 |
Richard Frith-Macdonald wrote:
>> Tima Vaisburd wrote:
>> I would really want is -readDataOfLength that would not block
>> until it gets all the length but would return what's available
> I think you need to use NSStream for that
> (or resort to using the read() system call).
Yes, I wrote something called bytestream (not a class, but a set of
functions
and macros) that uses NSStream. It seems to work. One thing I do
not quite like about it is that I simulated the blocking read with a
loop
of non-blocking [NSInputStream -read:maxLength:]. I was looking for a
better
alternative.
So the only better alternative seems to be the read() system call.
This is fine, I just wanted to completely understand the picture.
By the way, would you think it might make sense to extend NSStream
interface
to allow for blockiing reads and writes?
> I just tested again to make sure ...
[...]
Yes, thank you, you conducted thorough and decisive test.
> So I think the gnustep-base implementation matches the MacOS-X
> and the other two you found are 'wrong' in the sense that they
> don't match MacOS behavior (though the documentation is vague
> enough that either implementation could be viewed as correct).
Yes, it seems so.
Thanks again!
Tima