I run node myserver.js
that contains the code bellow, and after 40-50sec I get the error(bellow the code). Why do I get an error when nothing is happening?
var options = {
host: 'google.com',
port: '80',
path: '/',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': 'post_data.length'
}
};
var subscribeRequest = require('http').request(options, function(res) {
console.log('send request');
}).on('error', function(err){console.log(err.stack)});
after 40-50sec I get this error:
Error: connect ETIMEDOUT
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)