Re: re:Timing out an fgets

From: Date: Fri, 18 Aug 2000 03:30:47 +0000
Subject: Re: re:Timing out an fgets
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12400@lists.php.net to get a copy of this message
David Robley wrote: > > Yes I am wrong should be set_time_limit() > > > > But for some reason the max_execution_time variable in the php.ini is not > > working as my script will sit there for 5 mins trying to receive the fgets, > > this is why I originally was trying to timeout the fgets function, until I > > found that I could possibly timeout the whole script and take measures to > > recover from this situation. > > > > Yes the fsockopen timeout is functional, and there is no problem opening the > > socket, just the application I am connecting too is set not to return a > > response, so when I call fgets it just keeps going until the actual page times > > out, at least I am pretty sure of this. > > > > Thanks for your thoughts, I might try setting the timeout again to see what > > happens. > > > > Cheers, > > > > Joseph Blythe > > Maybe max_execution_time is related to cpu usage or user time, rather > than 'real' time, and because your script isn't doing anything but wait > on an external process, the timer is off? More theorising. Hmm, I am pretty sure it is based on seconds from the servers clock? consider the following code. set_time_limit(30); while( connection_timeout() == "FALSE" ) { fgets($fp, 1024) or die("Error no response recieved"); if ( connection_timeout() == "TRUE" ) { die("Connection timed out"); } } When I try this in my script it jumps straight to TRUE and says 'Connection timed out' this is in like 1 second, so I really don't get it, further more if the max_execution_time was working the timeout should be 1 minute as per the manual because as far as I can tell the set_time_limit is added to the max_execution_time. Am I using this right anyone? Also if anyone has any ideas on how I could wrap a timer around the fgets function I think this would be better, I might try to write a little timer now, but any suggestions would be nice :-) Regards Joseph Blythe

« previous php.general (#12400) next »