2010-10-15 19:05:22 +02:00
|
|
|
net = require('net');
|
|
|
|
connections = 0;
|
|
|
|
|
|
|
|
var errors = 0;
|
|
|
|
|
|
|
|
server = net.Server(function (socket) {
|
|
|
|
|
|
|
|
socket.on('error', function () {
|
|
|
|
errors++;
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2010-10-28 20:42:22 +02:00
|
|
|
//server.maxConnections = 128;
|
2010-10-28 20:33:33 +02:00
|
|
|
|
2010-10-15 19:05:22 +02:00
|
|
|
server.listen(9000);
|
|
|
|
|
|
|
|
var oldConnections, oldErrors;
|
|
|
|
|
|
|
|
setInterval(function () {
|
|
|
|
if (oldConnections != server.connections) {
|
|
|
|
oldConnections = server.connections;
|
|
|
|
console.log("SERVER %d connections: %d", process.pid, server.connections);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldErrors != errors) {
|
|
|
|
oldErrors = errors;
|
|
|
|
console.log("SERVER %d errors: %d", process.pid, errors);
|
|
|
|
}
|
|
|
|
}, 1000);
|
|
|
|
|