Re: detect bytes written on abort
- From: "Chung Leong" <chernyshevsky@xxxxxxxxxxx>
- Date: 5 Jan 2006 19:34:01 -0800
Shailesh Humbad wrote:
> Here is an advanced PHP question. Can anyone think of a way to detect
> the number of bytes written to output when a script is aborted?
If you are using Apache and can recompile the SAPI module, you can add
the following function to php_functions.c:
/* {{{ proto integer apache_get_bytes_sent(void)
Get the number of bytes actually sent */
PHP_FUNCTION(apache_get_bytes_sent)
{
php_struct *ctx;
ctx = SG(server_context);
RETURN_LONG(ctx->r->bytes_sent);
}
/* }}} */
If TCP/IP guarenteed delivery is to be believed, then that should be
the exact number of bytes received (but not necessarily saved) by the
client.
.
- Follow-Ups:
- Re: detect bytes written on abort
- From: Shailesh Humbad
- Re: detect bytes written on abort
- References:
- detect bytes written on abort
- From: Shailesh Humbad
- detect bytes written on abort
- Prev by Date: Re: detect bytes written on abort
- Next by Date: Re: |OT| Re: immigration to US, UK or CANADA
- Previous by thread: Re: detect bytes written on abort
- Next by thread: Re: detect bytes written on abort
- Index(es):