[英]Retrieving client IP address with Socket.io v1.0 and Express
How does one retrieve the IP address of a socket.io connecting client? 如何获取一个socket.io连接客户端的IP地址?
This does not work in Socket.io v1.0: Get the client's IP address in socket.io . 这在Socket.io v1.0中不起作用: 在socket.io中获取客户端的IP地址 。 It returns undefined
. 它返回undefined
。
I tried doing a console.dir
of the socket
object, but this does not seem to work. 我尝试做socket
对象的console.dir
,但这似乎不起作用。
这个怎么样:
socket.request.socket.remoteAddress
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.