doc: document directories in test directory
[platform/upstream/nodejs.git] / benchmark / idle_server.js
1 'use strict';
2
3 const net = require('net');
4 var connections = 0;
5 var errors = 0;
6
7 var server = net.Server(function (socket) {
8
9   socket.on('error', function () {
10     errors++;
11   });
12
13 });
14
15 //server.maxConnections = 128;
16
17 server.listen(9000);
18
19 var oldConnections, oldErrors;
20
21 setInterval(function () {
22   if (oldConnections != server.connections) {
23     oldConnections = server.connections;
24     console.log("SERVER %d connections: %d", process.pid, server.connections);
25   }
26
27   if (oldErrors != errors) {
28     oldErrors = errors;
29     console.log("SERVER %d errors: %d", process.pid, errors);
30   }
31 }, 1000);