mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
lol, i have apparently used python too much...
This commit is contained in:
parent
90dba34d80
commit
3c532fff15
@ -48,6 +48,7 @@ Initialization:
|
|||||||
# host: ip of server (use gethostbyname(hostname) to get from a dns name)
|
# host: ip of server (use gethostbyname(hostname) to get from a dns name)
|
||||||
# port: port of server
|
# port: port of server
|
||||||
function check_if_minetestserver_up($host, $port)
|
function check_if_minetestserver_up($host, $port)
|
||||||
|
{
|
||||||
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||||
$timeout = array("sec" => 1, "usec" => 0);
|
$timeout = array("sec" => 1, "usec" => 0);
|
||||||
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $timeout);
|
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $timeout);
|
||||||
@ -67,4 +68,5 @@ function check_if_minetestserver_up($host, $port)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user