php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21313 timeout for flush()
Submitted: 2002-12-31 09:52 UTC Modified: 2002-12-31 10:22 UTC
From: corinl at gmx dot de Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.0 OS: linux+apache
Private report: No CVE-ID: None
 [2002-12-31 09:52 UTC] corinl at gmx dot de
Hi,
i noticed that flush() sometimes takes a lot of time (> 100 seconds!), so woulnd't it be a good idea to add a timeout to flush? Would be really helpful sometimes, for example for a chat etc...
Thanks,
Corin

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-31 10:17 UTC] wez@php.net
it doesn't make sense for flush() to timeout, since it's purpose is to ensure that the output has been sent.
You just need to flush more often in your scripts if you are really having to wait 100 seconds for flush to complete.
Just as a sanity check, when it takes 100 seconds, how much data are you outputting from the page?
 [2002-12-31 10:22 UTC] corinl at gmx dot de
well, i use it in a chat script. the output most often is only a few hundret bytes, flushed about every second. it seems that sometimes (may be when the client disconnected) the flush 'hangs' (flush takes between 300-1500) seconds. it would be good to have a command like bool flush(int timeout), so the chat client could be kicked if flush would take longer than say 30 seconds.
my loop looks like
while (!connection_aborted() && !$do_end)
{
...
flush();
usleep(0.75*1000000);
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 16:01:31 2024 UTC