By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,311 Members | 1,197 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,311 IT Pros & Developers. It's quick & easy.

tracking bandwidth

P: n/a
Hi,

I have a chat script which I added very basic bandwidth tracking to as follows:

ob_start();
print "this is some output!";
print "this is more output!";
$bytes = ob_get_length(); // Amount of bandwidth used
ob_end_flush();

The problem is that this merely gives me how many bytes of text were printed...
The script uses JS functions in external files to generate everything for the
page, which means the .js files are cached after the first time and only a
<script> tag and a list of function calls are sent per refresh.

I would like a way to know if the client has cached these scripts, or if they
are being sent for the first time, etc, so I can add the file size of the .js
files to the bandwidth total..

e.g. if ($client_has_not_cached_js_files){ $bandwidth += $size_of_js_file; }

The chat script also allows for user icons, so again I would like to be able to
tell if each image was cached or whether a new copy of the image was sent to the
client.

Is there any way I can get this info with Javascript and then use AJAX to post
it back to the server ?

Regards,
Chris

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Sep 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Skeleton Man,
I would like a way to know if the client has cached these scripts, or if they
are being sent for the first time, etc, so I can add the file size of the .js
files to the bandwidth total..

e.g. if ($client_has_not_cached_js_files){ $bandwidth += $size_of_js_file; }

The chat script also allows for user icons, so again I would like to be able to
tell if each image was cached or whether a new copy of the image was sent to the
client.

Is there any way I can get this info with Javascript and then use AJAX to post
it back to the server ?


This is possible but why would you even want to run everything through a
PHP script first? There is no way of telling that the person got the
document unless PHP autoparses everything.

However, you might want to keep a log from apache on the information and
calculate it off of there log file, that will give you much more detail
to work with.

Mike
Sep 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.