That worked for my small example. But I've tried to implement it in my program
now and ran into some other problem:
[socket atEnd not] whileTrue: [self handleData: inputStream nextHunk]
Seemed to block.
You cannot know if the stream is atEnd unless a) it closes, b) you have
one more byte. So yes, #atEnd blocks (by design).
I would do something like
[
socket atEnd ifTrue: [ ^self ]
self handleData: inputStream nextHunk
] whileFalse.
with #handleData: returning true when it finishes reading a packet.
You may also note that the call to ZlibReadStream>>#processInput:size: which
will result in a call to RawInflateStream>>#processInput:size: will receive the
wrong flag (0 Z_NO_FLUSH or 4 Z_FINISH, and not 2 Z_SYNC_FLUSH) when atEnd
finally returns.
As far as I could see from the zlib source code, Z_SYNC_FLUSH only
matters for deflating. On inflation, it only looks for Z_NO_FLUSH,
Z_FINISH, Z_BLOCK.
Paolo
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk