- Joined
- Nov 28, 2004
- Messages
- 2,236
- Reaction score
- 0
I got one problem, and maybe you will help with the solution.
I made a small experiment, and saw that when user closes the browser, the script is still running for the defined amount of time.
I am developing an audio relay script, which outputs mp3 stream.
It's quite simple. When user connects to specific php file via WinAmp, script connects to remote server and relays the data to the user. But I don't know when the user hangs down, so I have to set_time_limit(). But when specified time ends, the script stops his actions and user stops receiving audio stream. If I set set_time_limit(0), the stream will always be relayed, BUT when the user disconnects, the server will still try to fetch data from external server.
I want to kill the script as soon as the user disconnects from it.
The script works as an ordinary php file, not sock server in CLI, so I can't see if user opened/closed data relay socket.
Any suggestions?
I made a small experiment, and saw that when user closes the browser, the script is still running for the defined amount of time.
PHP:
set_time_limit(10);
$cycle = true;
while ($cycle)
{
$handle = fopen("01.txt", "a");
if ($time < time() )
{
$time = time();
fwrite($handle, $time . "\n" );
**
fclose($handle);
**
I am developing an audio relay script, which outputs mp3 stream.
It's quite simple. When user connects to specific php file via WinAmp, script connects to remote server and relays the data to the user. But I don't know when the user hangs down, so I have to set_time_limit(). But when specified time ends, the script stops his actions and user stops receiving audio stream. If I set set_time_limit(0), the stream will always be relayed, BUT when the user disconnects, the server will still try to fetch data from external server.
I want to kill the script as soon as the user disconnects from it.
The script works as an ordinary php file, not sock server in CLI, so I can't see if user opened/closed data relay socket.
Any suggestions?
Last edited:

