Wednesday, 7 June 2017

node net.createServer(function(connection) {

I am using:

var server = net.createServer(function(connection) {

  console.log('remoteAddress: ', connection.remoteAddress);

  // logs 127.0.0.1 no matter where the client is connecting from
}

server.listen(4141, '0.0.0.0', function() { }

I've tried looking for other properties of connection to use but nothing I've tried gives the clients IP.

Thoughts?



via iss42

No comments:

Post a Comment