Skip to content

Instantly share code, notes, and snippets.

@pfreixes
Created July 17, 2017 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfreixes/b62c199e62ae09d1a5b9e13652c7a273 to your computer and use it in GitHub Desktop.
Save pfreixes/b62c199e62ae09d1a5b9e13652c7a273 to your computer and use it in GitHub Desktop.
var net = require('net');
var sleep = require('sleep');
var client = new net.Socket();
client.connect(6379, '127.0.0.1', function() {
console.log('Connected');
sleep.sleep(10); // wait for data and RST package
});
client.on('data', function(data) {
console.log('Received: ' + data);
});
client.on('close', function() {
console.log('Connection closed');
});
@pfreixes
Copy link
Author

Output

$ node test_nodejs.js
Connected
Received: -ERR max number of clients reached

Connection closed

The data in the buffer can be read event the RST already came into the system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment