2

My program parses a text document with HTTPS proxies in a string array. It then makes a GET request to ipify.org.

However, my program is throwing: Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:183:27). It terminates my program instead of throwing an error and continuing.

My code:

var fs = require('fs');
var async = require("async");
var request = require("request");

var proxies = fs.readFileSync(__dirname + '\\proxies.txt').toString().split("\n");

console.log(proxies.length + ' proxies loaded!');

async.forEachOf(proxies, proxy => {
    request({
        'url':'https://api.ipify.org',
        'method': "GET",
        'proxy': 'http://' + proxy
    },function (error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
    else {
        console.log(error.message);
    }
})
}, err => {
    console.log(err.message);
});

Any help is highly appreciated :)

Ed Bangga
  • 12,879
  • 4
  • 16
  • 30
Aaron
  • 41
  • 1
  • 1
  • 3

1 Answers1

1

[Node js ECONNRESET

the error is explained here.I think the url is not being connected for some reason...

Fathma Siddique
  • 266
  • 3
  • 15