Unfortunately, generosity didn't seem to help much: - (I had to investigate this myself.
Apparently, a fix was made (but node.js has not yet been released) to be able to get these values โโeven after the socket has been closed: https://github.com/joyent/node/commit/8c38b07252d86f4eef91344f8df4f0c3e38bca35
The workaround is to save the address during the connection:
srv.on('connect', function (socket) {
socket.stored_remoteAddress = socket.remoteAddress;
});
srv.on('clientError', function (err, socket) {
console.log(socket.cleartext.socket.stored_remoteAddress);
}
It works, but not really.
Apparently, even this does not work completely: - (
Node.js 0.11 does not emit a clientError event for SSL errors (for example), so there is no way to catch the situation there.
Node.js 0.12 clientError, TLS, 'cleartext'. "connect" "clientError" , ( "clientError" ).
, , - node.js(0.12.2, , ) , .