var http = require('http');
var fs = require('fs');
//100个端口
for(var port = 1000; port< 1100; port++){
http.createServer(function (request, response) {
//请忽略这种循环读文件的方式,只为了简便
fs.readFile('./index.html', function(err, content){
if(err) {
} else {
response.writeHead(200, { 'Content-Type' : 'text/html; charset=UTF-8' });
response.write(content);
response.end();
}
});
}).listen(port, '127.0.0.1');
}