On 25 Apr 2012, at 21:35, Sven Van Caekenberghe wrote:
I'll test some more...
Sean, Sorry, there was indeed something wrong, with my examples, but I couldn't figure it out at first. Things is, you can't say #beOneShot because then the connection is closed after the first succesfull request/response cycle, and with a streaming entity that means that the underlying stream is gone (well closed). It would have been nice if socket stream threw an exception instead of returning zeros ;-) These examples should work: ZnClient new systemPolicy; accept: ZnMimeType imageJpeg; url: 'http://caretaker.wolf359.be/sun-fire-x2100.jpg'; downloadToFileNamed: '/tmp/sun-fire-x2100.jpg'. ZnClient new systemPolicy; accept: ZnMimeType text; url: 'http://zn.stfx.eu/zn/numbers.txt'; downloadToFileNamed: '/tmp/numbers.txt'. Optionally a #close should be sent to the client as well (although garbage collection will close the socket eventually). By using #systemPolicy, success is enforced anyway. And when the pharo website is up again: ZnClient new systemPolicy; accept: ZnMimeType imagePng; url: 'http://www.pharo-project.org/images/pharo.png'; downloadToFileNamed: '/tmp/pharo.png'. Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill