If I run a server with the port 80, and I try to use xmlHTTPrequest i get this error: Error: listen EADDRINUSE
(如果我使用端口80运行服务器,并且尝试使用xmlHTTPrequest,则会收到此错误: Error: listen EADDRINUSE
)
Why is it problem for nodejs, if I want to do a request, while I run a server on the port 80?(在80端口上运行服务器时,如果要发出请求,为什么nodejs会出现问题?) For the webbrowsers it is not a problem: I can surf on the internet, while the server is running.(对于网络浏览器而言,这不是问题:服务器运行时,我可以在Internet上冲浪。)
The server is:(服务器是:)
net.createServer(function (socket) {
socket.name = socket.remoteAddress + ":" + socket.remotePort;
console.log('connection request from: ' + socket.remoteAddress);
socket.destroy();
}).listen(options.port);
And the request:(并要求:)
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
sys.puts("State: " + this.readyState);
if (this.readyState == 4) {
sys.puts("Complete.
Body length: " + this.responseText.length);
sys.puts("Body:
" + this.responseText);
}
};
xhr.open("GET", "http://mywebsite.com");
xhr.send();
ask by Danny Fox translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…