Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion require/class.Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,10 @@ public function str2int($string, $concat = false) {
}

public function create_socket($host, $port, &$errno, &$errstr) {
global $globalSourcesTimeOut;
$ip = gethostbyname($host);
$s = socket_create(AF_INET, SOCK_STREAM, 0);
socket_set_option($s, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $globalSourcesTimeOut, 'usec' => 0));
$r = @socket_connect($s, $ip, $port);
if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
Expand All @@ -741,8 +743,10 @@ public function create_socket($host, $port, &$errno, &$errstr) {
}

public function create_socket_udp($host, $port, &$errno, &$errstr) {
global $globalSourcesTimeOut;
$ip = gethostbyname($host);
$s = socket_create(AF_INET, SOCK_DGRAM, 0);
socket_set_option($s, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $globalSourcesTimeOut, 'usec' => 0));
$r = @socket_bind($s, $ip, $port);
if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
return $s;
Expand Down Expand Up @@ -925,4 +929,4 @@ public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20,
return $poMulti;
}
}
?>
?>