title: running node.js http server on multiple ports
body: <p>Please can anybody help me to find out how to get the server socket context in node.js, so that i will come to know request came on which port number on my server.
  I can read the server port if i request using http headers but I want it through network and something like socket context which tells request came on which port number. </p>
  
  <p>Here is the sample code:</p>
  
  <pre><code>var http=require('http');
  var url = require('url');
  var ports = [7006, 7007, 7008, 7009];
  var servers = [];
  var s;
  function reqHandler(req, res) {
          var serPort=req.headers.host.split(":");
          console.log("PORT:"+serPort[1]);//here i get it using http header.
  }
  ports.forEach(function(port) {
      s = http.createServer(reqHandler);
      s.listen(port);
      servers.push(s);
  });
  </code></pre>