Please someone help me find out how to get the server socket context in node.js so that I know that the request came to which port number on my server. I can read the server port if I request the use of http headers, but I want it through the network and something like a socket context that reports a request about which port number.
Here is a sample 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]);
Anuradha singh
source share