|
From: | Paolo Bonzini |
Subject: | Re: [Help-smalltalk] ZLib Z_SYNC_FLUSH/Z_FULL_FLUSH |
Date: | Wed, 22 Aug 2007 17:06:20 +0200 |
User-agent: | Thunderbird 2.0.0.6 (Macintosh/20070728) |
That would be mostmy my usage: having the tcp stream completly compressed and mostly replacing the tcpSocket by inflate/deflate streams. The actual read-loop in my program looks like this: [[inputStream atEnd not] whileTrue: [self handleData: inputStream nextHunk]] I would then after the compression-handshake replace inputStream (which is a tcp socket before the handshake) with an inflate stream.
Yes, but don't expect nextHunk to retrieve a whole packet. It could return only part of it. I would just do
[inputStream atEnd not] whileTrue: [ self handleData: inputStream ]You can assume that the RawInflateStream will not request more data from the socket when it sees a flush. So, if #handleData: does not try to read past the end of the packet, it should just work.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |