tracking bandwidth

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Skeleton Man

    tracking bandwidth

    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_no t_cached_js_fil es){ $bandwidth += $size_of_js_fil e; }

    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 =----
  • Mike Willbanks

    #2
    Re: tracking bandwidth

    Skeleton Man,
    [color=blue]
    > 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_no t_cached_js_fil es){ $bandwidth += $size_of_js_fil e; }
    >
    > 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 ?[/color]

    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

    Comment

    Working...