var net = require('net');
var server = net.createServer(function(c) { //'connection' listener
c.write('hello and welcome\r\n');
c.on('data', function(data) {
if(data.length > 0) {
c.write("Validating...\r\n");
c.pause();
}
setTimeout(function() {
c.resume();
c.write(data+'\r\n');
}, 5000);
});
});
server.listen(8124, function() { //'listening' listener
console.log('server bound');
});
那么,TCP RST数据包究竟是如何工作的呢。这不仅仅是发送HTTP响应,对吧?是否可以在Node中执行此操作?