[Jslib] Magic number in socket.js?

Pete Collins pete at mozdev.org
Tue Sep 16 11:24:34 EDT 2003

Charles Melhorn wrote:
> Stephen Knight wrote:
>> Ok.  That answers that question (I'll have to study that chapter to 
>> see how one is supposed to find out a conanical).
>>> Do note, the socket.js is very old, untouched for years and very 
>>> broken..
>> so I've noticed.  ;)  The last reference I've come across is Eric 
>> Murphy talking about updating socket.js "in a couple of weeks"...two 
>> years ago.
>> I don't think I'm doing too badly.  I now have it:
>> . opening a connection
>> . writing data to the socket
>> . reading some data (if binary then javascript nails any data after 
>> the null, I have to study the javascript api to see if there's a 
>> workaround)
>> . reading text but it's always one message behind (some sort of 
>> buffering/timing, I'm not using asynch routines yet).
>> I'm mainly stumbling around trying to figure out the necessary 
>> arguments to:
>> openInputStream and openOutputStream.
>> I'm not too sure if the transport is fully upto spec:
>> . isAlive doesn't seem to work correctly (the target says the 
>> connection is alive but isAlive denies it).
>> I'm about to "study" Murphy's CBSConnection class (which means I'll 
>> probably start stripping it for parts). 
> You may find something useful in my version of socket.js, which
> I cobbled together from the JsLib file and from the version used
> in Chatzilla. It's not as polished, generalized, or commented as
> it should be, and has only been tested with Mozilla 1.2 and 1.3;
> however, I did consult with both Rob Ginda (Chatzilla author) and
> Darin Fisher (primary necko developer) as I was developing it.
> http://www.mozdev.org/source/browse/dertandembrowser/source/content/dtbSocket.js?rev=1.1&content-type=text/x-cvsweb-markup 
> You can see how it's called (from the connectButtonHandler() routine)
> here:
> http://www.mozdev.org/source/browse/dertandembrowser/source/content/dtbNavOverlay.js?rev=1.1&content-type=text/x-cvsweb-markup 
> Note that my socket class uses only asychronous routines, as the
> synchronous calls weren't working with Moz 1.2/1.3.
> Charles

Thanks Charles!

Since socket.js is *so* old and horribly broken, how about we use 
Charles code as a starting point.

The motto here is "if it works, check it in"  :-)

Steve, I know you are wokring on socket stuff. What are your thoughts?

Charles, is it cool if we swiped this code for jslib?


Pete Collins

More information about the Jslib mailing list