mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-03-12 21:42:02 +01:00
Don't throw too much errors if not root ping
This commit is contained in:
@@ -164,7 +164,10 @@ function ping($ip, $timeout = 2,$rTimes = 2) {
|
||||
while ($retry < $rTimes){ //Retry rTimes times if fail
|
||||
//Create ICMP socket and see if works
|
||||
$package = "\x08\x00\x7d\x4b\x00\x00\x00\x00PingHost";
|
||||
$socket = socket_create(AF_INET, SOCK_RAW, 1);
|
||||
$socket = socket_create(AF_INET, SOCK_RAW, 1);
|
||||
if ($socket == FALSE){ //If not works, please don't continue.
|
||||
break;
|
||||
}
|
||||
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $timeout, 'usec' => 0));
|
||||
socket_connect($socket, $ip, null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user