I'm searching for a method to ping local devices on my network, like if I use de ping command in my terminal, to ping my router or any other devices connected. I already found way to ping server like google.com but it seems it's not working on local address. Is that possible or not ? Here is my typescript code:
private source = interval(3000);
constructor(private _http: HttpClient) { }
...
getStatutDevice(ip: string){
//IP Value look like "192.168.1.20" for example
this.source.subscribe(() => {
this._http.get(ip, { observe: 'response' })
.pipe(first())
.subscribe(resp => {
if (resp.status === 200 ) {
console.log(true);
} else {
console.log(false);
}
}, err => console.log(err));
});
}
I got this error in the console:
zone-evergreen.js:2863 GET http://localhost:4200/192.168.1.20 404 (Not Found)
If I put "https://" before the ip address, I got:
GET https://192.168.1.20/ net::ERR_CONNECTION_REFUSED
I don't know what this means to find a solution.