Re: php conditional loop question
| From: | Marek Kilimajer | Date: | Thu, 14 Aug 2003 14:41:21 +0000 |
| Subject: | Re: php conditional loop question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159586@lists.php.net to get a copy of this message | ||
I think you need to set the connection to nonblocking mode. Use
bool stream_set_blocking ( resource stream, int mode)
Then if no data is available for a longer time (it's up to you), you can break out of the loop and do something else.
Randy L Johnson Jr wrote:
I am running php as a client and I have the script running 24/7 to download the data from the connection. Is there a function to see if the connectiondrops. ??is there a way to keep restart the function in the script. perhaps use a while and exit the function with a number exit(3) and use that value as the condition in the while? Randy * Thus wrote Randy L Johnson Jr (rjohnson@seasidepc.com):I have done this but it does not seem to ever get to the end of file, Ihaveit inserting the values into the database, it goes for awhile around 12 to24 hours and then stops inserting the values into the database and I havetorestart the script...ah.. so it sound like the connection is dropping at some point thus your socket becomes not usuable.From my previous post you can usehttp://php.net/stream_set_timeout btw, any reason why your using pfsocketopen vs. just fsocketopen? the pfsocketopen would be only needed if you plan on using that socket on a different page request. Come to think of it the pfsocketopen might even give you problems even if you use the stream_set_timeout function. HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .