When using socket.IO (Version > 1.3) in a Node.js
Server, is there an easy way to get the IP address of an incoming connection? It always show me server IP address. I need to get the Client IP Address.
I tried using
console.log(socket.handshake.headers['x-forwarded-for'] || socket.request.connection.remoteAddress);
But it shows 127.0.0.0. I am using socket.io
Version 1.3.7. Please Help me out.
您可以使用socket.client.conn.remoteAddress
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.