From bmorency at newtraxtech.com Wed Aug 1 07:06:18 2007 From: bmorency at newtraxtech.com (Bruno Morency) Date: Wed, 01 Aug 2007 10:06:18 -0400 Subject: [Jslib] Socket.open() returns before socket is connected In-Reply-To: <46AFA661.3030003@mozdevgroup.com> References: <9B790FB2-A3EF-4BFF-B0EC-95D28CEF5E6D@newtraxtech.com> <46AFA661.3030003@mozdevgroup.com> Message-ID: <0058B242-B911-46A8-A4D2-F9EB0F19EAFF@newtraxtech.com> Hi Pete, I could not get my problem fixed so I wrote 2 libraries for my needs on Monday. There's a client socket and a server socket. I need those libraries for an application where the interface (XUL) needs to communicate with external hardware modules through local sockets (the hardware module is abstracted by an executable which handles communication with the interface commands can be made from either sides). Disclaimer : Server socket only listens to local connections and works with one-line commands. Libraries seems to work great but they are a first draft. I attached the libraries (renamed as .txt files) and usage examples, feel free to use and submit improvements. Bruno Morency PS : Libraries built using the following as references : - http://www.xulplanet.com/tutorials/mozsdk/sockets.php - http://www.xulplanet.com/tutorials/mozsdk/serverpush.php - http://www.koders.com/javascript/ fid0726D96D246710A6D8501D5F26CF178F505CF706.aspx?s=nsIInputStream - JSlib socket.js -------------- next part -------------- A non-text attachment was scrubbed... Name: socketLibs.zip Type: application/zip Size: 5163 bytes Desc: not available Url : http://mozdev.org/pipermail/jslib/attachments/20070801/eacc2d52/attachment.zip -------------- next part -------------- On 07-07-31, at 17:15, Pete Collins wrote: > The socket code is older and may need some updating. I'll have a > look asap. > > Thanks > > --pete > > Bruno Morency wrote: > >> Hi, >> >> I'm trying to use the socket module of jslib and there's something I >> don't get with the open() method, it seems to return before the >> socket is actually connected and a write() called immediatly after >> the open() throws "Socket.write: Not Connected." exceptions. Is there >> any way to make sure the socket is really connected when Socket.open >> () returns? If not, how do I passed function to be called when it is >> (Socket.async() doesn't seem to work with Socket.open())? >> >> What I want to do : >> >> var mysock = new Socket(); >> mysock.open('127.0.0.1',3333); >> mysock.write("some command\n"); >> >> This almost always throws "Socket.write: Not Connected." exceptions. >> However, if a put a manual pause between open() and write(), it works >> all right : >> >> var mysock = new Socket(); >> mysock.open('127.0.0.1',3333); >> alert('pause, press OK to return'); >> mysock.write("some command\n"); >> >> That's what make me believe the problem with the first code snippet >> is not that there is a problem with the code or the deamon listening >> on port 3333 but the fact that open() return before the socket is >> ready. >> >> Anyone knows how to have Socket.open() block until the socket we are >> connecting to is connected? >> >> >> Thanks >> >> >> Bruno >> _______________________________________________ >> Jslib mailing list >> Jslib at mozdev.org >> http://mozdev.org/mailman/listinfo/jslib >> >> >> >> > > -- > Pete Collins - Founder, Mozdev Group Inc. > www.mozdevgroup.com > Mozilla Software Development Solutions > tel: 1-719-302-5811 > fax: 1-719-302-5813 > > _______________________________________________ > Jslib mailing list > Jslib at mozdev.org > http://mozdev.org/mailman/listinfo/jslib From pickel80209 at gmail.com Tue Aug 7 11:25:07 2007 From: pickel80209 at gmail.com (pickel jones) Date: Tue, 7 Aug 2007 12:25:07 -0600 Subject: [Jslib] JSLib Uninstall Problems Message-ID: <1b55a46c0708071125w559cd22axfb5d520200a1e1ec@mail.gmail.com> Greetings all, Thanks for all the great work on JSLib; it provides a much needed JS scripting layer overtop FF/etc. I'm having a slight issue related to the "jslibUninstall" function: I'm using this function with a notification callback, eg: jslibUninstall('packageName', Package_UninstallDone); This works (callback is indeed executed), however when I attempt to perform post-uninstall cleanup within the notification callback, things go wrong. Specifically, I'm attempting to modify some preferences settings on the *second* execution of the callback function (stage == true). When I attempt this, the uninstall throws an exception and fails. It seems to be related to the fact that the global variable 'Components' is no longer available on the second execution of this callback handler. "Components" *is* available on the first execution of the callback. See my callback code below: function AlchemyTB_UninstallDone(filesList, stage) { if (stage == true) { try { var prefs = Components.classes["@ mozilla.org/preferences-service;1"].getService( Components.interfaces.nsIPrefBranch); } catch (e) { } } } Note, if i change the above to "if (stage == false)", it's able to retrieve the Preferences service. Stage == true, no dice. Is there something I need to do to access/reinitialize global objects like "Components" so they can be used within the second callback execution? Otherwise, I don't see how it's possible to remove preferences after an uninstall has occurred. Any help would be appreciated, many thanks ! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mozdev.org/pipermail/jslib/attachments/20070807/4058013c/attachment.html From pete at mozdevgroup.com Mon Aug 20 06:10:47 2007 From: pete at mozdevgroup.com (Pete Collins) Date: Mon, 20 Aug 2007 07:10:47 -0600 Subject: [Jslib] JSLib Uninstall Problems In-Reply-To: <1b55a46c0708071125w559cd22axfb5d520200a1e1ec@mail.gmail.com> References: <1b55a46c0708071125w559cd22axfb5d520200a1e1ec@mail.gmail.com> Message-ID: <46C992D7.9050700@mozdevgroup.com> > > > Is there something I need to do to access/reinitialize global objects > like "Components" so they can be used within the second callback > execution? Otherwise, I don't see how it's possible to remove > preferences after an uninstall has occurred. > > Any help would be appreciated, many thanks ! If you notice, uninstall was written back in 2003 when there was no way to uninstall an xpi package. It was written for the old seamonkey mozilla suite. If you are using Firefox, it is not recommended you use uninstall as the installation architecture has changed a lot since. You can uninstall via script using Extension Manager interfaces ... If you have some global prefs you wish to remove, you can add a listener that will notify you when your extension is being uninstalled, but prefs these days are usually set in the extensions bundled prefs file which is removed when the add-on is uninstalled. --pete -- Pete Collins - Founder, Mozdev Group Inc. www.mozdevgroup.com Mozilla Software Development Solutions tel: 1-719-302-5811 fax: 1-719-302-5813 From ih8spam at gmail.com Thu Aug 30 15:29:41 2007 From: ih8spam at gmail.com (sykotik) Date: Thu, 30 Aug 2007 15:29:41 -0700 (PDT) Subject: [Jslib] jsLib Question In-Reply-To: <4639CC1A.9040002@mozdevgroup.com> References: <4639CC1A.9040002@mozdevgroup.com> Message-ID: <12417479.post@talk.nabble.com> earlpiggot wrote: > Hi, > > a couple of days ago jslib auto updated to version 0.1.350. Ever > since, every time I start Bon Echo (I use the 2.0.0.x branch > nightlies), I get the following warning window and I have to press OK. > > http://i15.tinypic.com/4mlp2cy.png > Hey all. I'm having the same issue with FF 2.0.0.6 and the latest, self-updated jsLib. Any solution to the jsLib about box popping up every time I start FF? BTW, I apologize if there's a more appropriate forum to post questions like this. If so, please let me know. Thanks! s. -- View this message in context: http://www.nabble.com/Re%3A-jsLib-Question-tf3686177.html#a12417479 Sent from the MozDev - jslib mailing list archive at Nabble.com.