인터넷 검색에서 이것은 너무 많은 파일이 열렸다는 것을 알았지 만 검사했고 아무 것도 있지만이 서버는 실행되지 않았습니다. 누군가 나를 도와주세요.처리되지 않은 오류 nodejs 응용 프로그램의 EMFILE
events.js : 72
throw er; // 처리되지 않은 '오류'이벤트
^
오류 : 순 듣고에서
((: 904 : 11 net.js) Server._listen2에서
(19 net.js : 1023) EMFILE
errnoException에서 듣기 .js : 1064 : 10)
Server.listen (net.js : 1138 : 5)
Function.app.listen (/home/kkcorps/Desktop/check/node_modules/express/lib/application.js : 529 : 24)
at Object. (/home/kkcorps/Desktop/check/port_2.js:48:5)
at Module._compile (module.js : 456 : 26)
at Object.Module._extensions..js (module.js : 474) : 10) Module.load (module.js에서
: 356 : 32) Function.Module._load (module.js에서
: 312 :
var express = require('express');
var path = require('path');
var app = express();
app.configure(function(){
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.static('static'));
app.set('view engine', 'hbs');
app.set('views', path.join(__dirname, 'views'));
});
var net = require('net');
var port = 1;
var timeout = 2000;
var open_ports = [];
while(port < 10000)
{
(function(port){
var sckt = new net.Socket();
sckt.setTimeout(timeout, function(){
sckt.destroy();
});
sckt.connect(port,function(){
console.log('connected to localhost on port: '+ port);
open_ports.push(port);
//client.write('connected to localhost');
});
sckt.on('error',function(e){
sckt.destroy();
});
})(port);
port++;
}
//open_ports = ['1','2','3'];
app.get('/', function(req, res){
//res.send('Hello world');
res.render('index', {cont: open_ports});
})
app.listen(3000);
console.log('server running on port 3000');
socket.connect에 로컬 호스트 IP (즉, 127.0.0.1)를 추가하는 방법을 모르지만 프로그램이 올바르게 실행되기 시작했습니다. – user3625371
이상한가,'localhost'와 동일합니까? – vkurchatkin