Page 1 of 1

timeout parameter of fsockopen function not working?

Posted: Mon Nov 30, 2009 2:48 am
by rahesh
Hi

Here is my code :

<?php
$status=0;
if(isset($_GET['host']) && isset($_GET['port'])){
try{
$fp = @fsockopen ($_GET['host'], $_GET['port'], $errno, $errstr, 5);
if ($fp) {
$status=1;
fclose($fp);
}
}
catch(Exception $ex){

}
}
echo $status;
?>

Here the timeout parameter is not working.

Anybody please help me in this.

Regards
Rahesh

Re: timeout parameter of fsockopen function not working?

Posted: Mon Nov 30, 2009 12:23 pm
by AbraCadaver
How do you know it's not working???

Re: timeout parameter of fsockopen function not working?

Posted: Mon Nov 30, 2009 10:57 pm
by rahesh
its taking more than 5 seconds to get response..

Re: timeout parameter of fsockopen function not working?

Posted: Tue Dec 01, 2009 3:48 am
by Apollo
Try this first:

Code: Select all

ini_set('default_socket_timeout',5);