How does Socket Server Node.js know which IP or domain the client is connected to?

How to find out which IP / host the client is connecting to in node.js TCP Server?

var server = net.createServer(function (stream) { // The server is behind a firewall, // how can I know how the client connect to this server? console.log(stream.localAddress); }); server.listen(21, '0.0.0.0'); 

thanks

+2
source share
1 answer

Got ans: we can use stream.address () to get the port and connect the client to the client.

0
source

All Articles