Christian Biesinger wrote:
Well, it works just like for an input stream...
Do you need the nonblocking behaviour though? Maybe a blocking output
stream would be better for you.
I am implementing a simple FTP client. For reading, I define an async
listener object and create a pump:
var pump =
Components.classes["@mozilla.org/network/input-stream-pump;1"].
createInstance(Components.interfaces.nsIInputStreamPump);
pump.init(stream, -1, -1, 0, 0, false);
pump.asyncRead(dataListener,null);
and the dataListener is called whenever there is data to read. However
for writing, I do not see a nsIOuputStreamPump, so the loop must be
started some other way.
for instance:
try{
outputstream.asyncWait(dataListener, 4096, null);
}catch(e){ outputstream.asyncWait(dataListener, 4096, null); }
???
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom