Limiting time of PHP script.

From: Date: Sun, 03 Feb 2002 11:48:40 +0000
Subject: Limiting time of PHP script.
Groups: php.general 
Request: Send a blank email to php-general+get-83253@lists.php.net to get a copy of this message
I've a little PHP script that waits for commands and reply to them, it's setup to run from inetd, and so acts as a server. My problem is that I want to limit the time this script will wait for a command (in this case, a line, read by fgets), but set_time_limit seems to only count the time PHP spends executing the script, and not the time it waits for a line to be read, like the manual describes it. Is there a way to limit the time fgets will wait for a line, or another way to solve this problem? Any help is appreciated! Below I've attached part of my script. Thanks! ----------------------------------------- #!/usr/bin/php <? $sin = fopen("php://stdin", "r"); while (1) { // I need to limit the time fgets will wait for a line to be read. $cmd = fgets($sin, 4096); echo "Cmd: $cmd\n"; } ?> -----------------------------------------

« previous php.general (#83253) next »