I'm trying to learn to use socket transport service, openInputStream() and a unix-domain socket. A toy GPS GeolocationProvider.
After things are set up and data is flowing, do I have to keep an explicit reference to the socket, the "transport" ? It would feel right, if I let off from the transport variable and just held on to the inputStream, closing the stream if an EOF or error occurs.
In NetUtil.jsm, a scriptableInputStream is created, used and then just forgotten, presumably to be garbage-collected. Is everything like this, no need to explicitly close ? If the close must be done manually, can I get the transport somehow back from the inputStream object ? stream.parent or something like that ?
What is the effect of the .QI() below ? I've seen it used in 2 different ways, sometimes for the return value,
and sometimes just for some side-effectz = xxx.QI(interface);
yyy.QI(interface);
Code: Select all
this.stream = this.socket.openInputStream(0, 0, 0).QueryInterface(Ci.nsIAsyncInputStream);
Juha
EDIT: Got that QI() now. Very helpful reading in https://developer.mozilla.org/en-US/Add ... UL_School/