Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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');
});
Owner

pfreixes commented Jul 17, 2017

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