mirror of
https://github.com/nodejs/node.git
synced 2024-11-22 15:47:56 +01:00
22 lines
400 B
JavaScript
22 lines
400 B
JavaScript
var fork = require('child_process').fork;
|
|
var net = require('net');
|
|
var buffer = new Buffer(1024 * 1024);
|
|
|
|
function write(socket) {
|
|
if (!socket.writable) return;
|
|
|
|
socket.write(buffer, function() {
|
|
write(socket);
|
|
});
|
|
}
|
|
|
|
var server = net.createServer(function(socket) {
|
|
server.close();
|
|
write(socket);
|
|
});
|
|
|
|
server.listen(8000, function() {
|
|
fork(__dirname + '/throughput-child.js');
|
|
});
|
|
|