note 76781 added to function.mysqli-connect
| From: | martin dot velek at gmail dot com | Date: | Mon, 30 Jul 2007 16:53:05 +0000 |
| Subject: | note 76781 added to function.mysqli-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129050@lists.php.net to get a copy of this message | ||
When you need more(less) timeout, you can use this. This only guarantees that host and port are
opened. It is suitable on the very high speed networks(LAN) and where one second is not acceptable.
$timeoutInSeconds can be set to any numeric value
e.g. "1/2", "0.500","0.1","0.01" etc.
--------------------------------------------------------------
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
$fp = fsockopen("$mysqlHost",$mysqlPort, $errno, $errstr,$timeoutInSeconds);
if (!$fp)
{
//timeout mostly
echo "ERR: $errno - $errstr<br>\n";
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Timeout $time sekund";
}
else
{
fclose($fp);
}
----
Server IP: 147.32.160.17
Probable Submitter: 213.29.97.13
----
Manual Page -- http://www.php.net/manual/en/function.mysqli-connect.php
Edit -- https://master.php.net/note/edit/76781
Del: integrated -- https://master.php.net/note/delete/76781/integrated
Del: useless -- https://master.php.net/note/delete/76781/useless
Del: bad code -- https://master.php.net/note/delete/76781/bad+code
Del: spam -- https://master.php.net/note/delete/76781/spam
Del: non-english -- https://master.php.net/note/delete/76781/non-english
Del: in docs -- https://master.php.net/note/delete/76781/in+docs
Del: other reasons-- https://master.php.net/note/delete/76781
Reject -- https://master.php.net/note/reject/76781
Search -- https://master.php.net/manage/user-notes.php