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