title: nsISocketTransportService using Firefox addon sdk
body: <p>I'm trying to use Firefox to read the SSH banner.  ie. when you initially connect to an SSH server the server sends you its banner, identifying the server software and you send the SSH server your banner, identifying your client software.</p>
  
  <p>To do so I'm using the example at this URL:</p>
  
  <p><a href="https://stackoverflow.com/questions/7850258/is-there-nsiclientsocket-in-firefox-extension-javascript">Is there nsiClientSocket in firefox extension javascript?</a></p>
  
  <p>Here's my code:</p>
  
  <pre><code>'use strict';
  
  const {Cc,Ci} = require("chrome")
  const prefs = require("simple-prefs");
  
  
  exports.main = function(options,callbacks) {
      var transport = Components.classes["@mozilla.org/network/socket-transport-service;1"]
                                .getService(Components.interfaces.nsISocketTransportService)
                                .createTransport(null, 0, "localhost", 22, null);
  
      //var output = transport.openOutputStream(0, 0, 0);
      var input = transport.openInputStream(0, 0, 0);
      var data = "test";
      dump(stream.read());
      //stream.write(data, data.length);
      //stream.close();
      dump("all done!");
  };
  </code></pre>
  
  <p>When I do cfx xpi with that I get this:</p>
  
  <pre><code>The following lines from file C:\path\to\lib\main.js:
     8: var transport = Components.classes["@mozilla.org/network/socket-transport-service;1"]
     9: .getService(Components.interfaces.nsISocketTransportService) use 'Components' to access chrome authority. To do so, you need to add a line somewhat like the following:
  
    const {Cc,Ci} = require("chrome");
  
  Then you can use any shortcuts to its properties that you import from the 'chrome' module ('Cc', 'Ci', 'Cm', 'Cr', and 'Cu' for the 'classes', 'interfaces', 'manager', 'results', and 'utils' properties, respectively. And `components` for `Components` object itself).
  </code></pre>
  
  <p>So I try this instead:</p>
  
  <pre><code>'use strict';
  
  const {Cc,Ci} = require("chrome")
  const prefs = require("simple-prefs");
  
  
  exports.main = function(options,callbacks) {
      var transport = components.classes["@mozilla.org/network/socket-transport-service;1"]
                                .getService(interfaces.nsISocketTransportService)
                                .createTransport(null, 0, "localhost", 22, null);
  
      //var output = transport.openOutputStream(0, 0, 0);
      var input = transport.openInputStream(0, 0, 0);
      var data = "test";
      dump(stream.read());
      //stream.write(data, data.length);
      //stream.close();
      dump("all done!");
  };
  </code></pre>
  
  <p>ie. I make Components components (lowercase) and Components.interfaces just interfaces.  But then I get this error on the console:</p>
  
  <pre><code>    var transport = components.classes["@mozilla.org/network/socket-transport-service;1"]
  ReferenceError: components is not defined
  </code></pre>
  
  <p>Any ideas?</p>