I have some client inside an internal network but DHCP changes each time their IP.
I know that each client answer with a number on a REST call:
http://myclient/status ---> if it is only a number it is OK
I don't want to use domains because of some buggy behaviour that I don't have with IP address, so my solution is something like:
for (var i = 0; i < 255; i++) {
    var options = {
        host: '192.168.1.'+i,
        port: 80,
        path: '/status/',
        auth: 'root:password'
    };
    var request = http.get(options, function(htres){
        var __CLIENT_IP__ = ???? // how to access client ip here?
        var body = "";
        htres.on('data', function(data) {
            body += data;
        });
        htres.on('end', function() {
            if( htres.statusCode == 404 ) {
                res.end();
                return;
            }
            // ...
            // PARSE MY INT HERE
            // ...
        })
        htres.on('error', function(e) {
            console.log(e.message);
        });
    }).on('error', function(e) {
        var __CLIENT_IP__ = ???? // how to access client ip here?
        console.log(__CLIENT_IP__ + ' does not seems to have port 80 opened');
    });
};
 
     
    