You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
661 B

'use strict';
const common = require('../common');
var net = require('net');
var server = net.createServer(common.mustCall(function(stream) {
stream.setTimeout(100);
stream.resume();
stream.on('timeout', common.mustCall(function() {
14 years ago
console.log('timeout');
// try to reset the timeout.
14 years ago
stream.write('WHAT.');
}));
14 years ago
stream.on('end', function() {
console.log('server side end');
stream.end();
});
}));
server.listen(0, function() {
var c = net.createConnection(this.address().port);
14 years ago
c.on('data', function() {
c.end();
});
14 years ago
c.on('end', function() {
console.log('client side end');
server.close();
});
});