CIRCDCCFileTransfer.onSocketAccepted Member
CBSConnection points the event here.
Syntax
object.onSocketAccepted(socket, transport);
Arguments
Argument | Summary |
---|---|
socket | |
transport |
Returns
Remarks
See Also
Source Code
function dfile_onSocketAccepted(socket, transport)
{
this.state.getAccept();
this.connection.accept(transport, null);
this.state.socketConnected();
this.position = 0;
this.ackPosition = 0;
this.remoteIP = transport.host;
this.eventPump.addEvent(new CEvent("dcc-file", "connect",
this, "onConnect"));
try {
this.filestream = Components.classes["@mozilla.org/binaryinputstream;1"];
this.filestream = this.filestream.createInstance(nsIBinaryInputStream);
this.filestream.setInputStream(this.localFile.baseInputStream);
// Start the reading!
var d;
if (this.parent.sendChunk > this.size)
d = this.filestream.readBytes(this.size);
else
d = this.filestream.readBytes(this.parent.sendChunk);
this.position += d.length;
this.connection.sendData(d);
}
catch(ex)
{
dd(ex);
}
// Start the reading!
if (jsenv.HAS_NSPR_EVENTQ)
this.connection.startAsyncRead(this);
else
this.eventPump.addEvent(new CEvent("dcc-file", "poll", this, "onPoll"));
}