socket client reading string

sugar_lisp <[email protected]> Thu, 25 Feb 2010 15:54:26 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
Hi

I have developed socket server in delphi and socket client in mozilla
javascript. The server sends string data to socket client. I am not sure how
to read it. I tried the following:


var transportService =
Components.classes["@mozilla.org/network/socket-transport-service;1"].getService(Components.interfaces.nsISocketTransportService);
var transport =
transportService.createTransport(null,0,'127.0.0.1',4444,null);


var stream = transport.openInputStream(0,0,0);
var instream = Components.classes["@mozilla.org/scriptableinputstream;1"]
.createInstance(Components.interfaces.nsIScriptableInputStream);
instream.init(stream);
var chunk = instream.read(512);
alert(chunk); // gives me blank, even though i send some string from the
server


Please guide me and tell me what I am doing wrong.

Thank you.




-- 
View this message in context: http://old.nabble.com/socket-client-reading-string-tp27695198p27695198.html
Sent from the Mozilla - JavaScript Debugger mailing list archive at Nabble.com.