Looking for a way to ping devices on my local network, similar to using the ping command in the terminal to ping the router or any connected devices. I've figured out how to ping servers like google.com, but it doesn't seem to work with local addresses. Is it even possible? Below 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));
});
}
Encountered this error in the console:
zone-evergreen.js:2863 GET http://localhost:4200/192.168.1.20 404 (Not Found)
When I add "https://" before the ip address, I get:
GET net::ERR_CONNECTION_REFUSED
Struggling to decipher these messages and find a solution.