I'm working on a Doctor-Patient project(Web+Android) where when patient books a token, it first checks if doctor is online or not; if it is online patient can book.
For this purpose I have used ping user IP approach i.e. when patient submits token, it pings at Doctor's IP and if he's online(has active internet connection) it registers patient token. But that seems not to be working as received data from ping indicates 100% packet loss.
Can't use flag setting which is triggered on doctor's last action which is not real time.
Please suggestion if you have solution for this issue.
<?php
// unset variables first to avoid mixing the results from previous calls
// 0 for success, 1 for packet loss, 2 for other error.
$retval=-1;
$output=array();
exec("ping 127.0.0.1 -c2 -w2 2>&1",$output,$retval);
echo "Return code: ".$retval."<br>\n";
echo implode("<br>\n",$output);
?>