473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Measuring bandwidth used using PHP.

Markus
6,050 Expert 4TB
I've had a good luck around for something along the lines of what i wanted, all to no avail.
Was just wondering if anyone knew of a way to record bandwidth usage?
Mar 1 '08 #1
5 1364
hsriat
1,654 Expert 1GB
I've had a good luck around for something along the lines of what i wanted, all to no avail.
Was just wondering if anyone knew of a way to record bandwidth usage?
Good Question! I'm looking forward is someone gives a good reply.

I can give you an idea though...

When user clicks on a bandwidth checking link, send some data to the user's browser. And when the data reaches completely, tell JavaScript to send it back.
Calculate time between start of sending and end of receiving that data.
Divide the data size by (4 * $seconds_taken). May be it could tell you the bandwidth.

But what if user is downloading or uploading something along with?

PS: Don't laugh!! :p
Mar 1 '08 #2
dlite922
1,584 Expert 1GB
Good Question! I'm looking forward is someone gives a good reply.

I can give you an idea though...

When user clicks on a bandwidth checking link, send some data to the user's browser. And when the data reaches completely, tell JavaScript to send it back.
Calculate time between start of sending and end of receiving that data.
Divide the data size by (4 * $seconds_taken). May be it could tell you the bandwidth.

But what if user is downloading or uploading something along with?

PS: Don't laugh!! :p

no one's laughing, i wouldn't have thought of that.....okay maybe i would have...but you went into detail.

I say so what if he's downloading something, that's his bandwidth currently at this time he's browsing the website, display the info (quality) based on that bandwidth.

If he comes back another time with more bandwidth he can see the better quality vido/flash/porn/etc...



-DM
Mar 7 '08 #3
hsriat
1,654 Expert 1GB
I say so what if he's downloading something, that's his bandwidth currently at this time he's browsing the website, display the info (quality) based on that bandwidth.
That's what I said in the second last line.

PS: Glad to know you didn't laugh. :D
Mar 7 '08 #4
Markus
6,050 Expert 4TB
That's what I said in the second last line.

PS: Glad to know you didn't laugh. :D
I didn't laugh, either!

Could you elaborate on:
When user clicks on a bandwidth checking link, send some data to the user's browser. And when the data reaches completely, tell JavaScript to send it back.
?

Cheers
Mar 7 '08 #5
hsriat
1,654 Expert 1GB
When user clicks on the link, create a hidden iframe and give src of an HTML file, something like this:[html]<html>
<body onload="document.forms[0].submit()">
<form acton="return_data.php" method="post">
<input type="hidden" name="data" value="----------fake text of size say 50Kb---------" />
</form>
</body>
</html>[/html]
Since the iframe is hidden, nothing would be shown on the browser.

When the server gets the request from a user for that file, save start time somewhere (of course corresponding to the user id or IP), and when return_data.php gets back the whole data, save the end time.

I hope it can work, but not sure! This is just a first try. I've never done anything like this.
Mar 7 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Marek Möhling | last post by:
My server (Apache/1.3.28 - PHP/4.3.3) is configured to receive gzipped data via: Header append Accept-Encoding "gzip, deflate" PHP is configured to send gzipped data via: php_value...
2
by: Filip Polsakiewicz | last post by:
Hi all, I would like to read the currently used bandwidth using VB.NET or VJ#. I tried using the PerformanceCounter but this one only displays the available bandwidth and not the used bandwidth....
1
by: Skeleton Man | last post by:
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(); //...
6
by: Matthew Nuzum | last post by:
We've had a chance to talk to some of our competitors who have recently gone out of business. One of the major failings that contributed to their collapse was not accurately understanding how much...
8
by: Dominic Martin | last post by:
Hi, I need to setup an ODBC link over our Internet connection between MS Access (local) and a MySQL server (Remote - the local PC has the MySQL ODBC driver installed). What kind of bandwidth...
1
by: Ryan Moore | last post by:
I'm trying to make a "bandwidth analyzer" using C# (ASP.NET) which will display the amount of bandwidth used by a website, broken down by direcotry within the site. I'm considered analyzing log...
3
by: vadim | last post by:
Hi, Does anybody have an idea on how to reply to a client who's asking about how much bandwidth my app will need. It's asp.net app with SQL Server backend. Is there any general rule of thumb on...
74
by: Dominik Wallner | last post by:
Hi! I'm currently implementing a program which measures voltages through an external USB-AD-converter. It should output those values as time/voltage pairs. My problem is to measure the time...
4
by: Zytan | last post by:
This may be the dumbest question of all time, but... When I set the packet size, does it mean ALL packets are that size, no matter what? Let's say the packet size is 8KB, and I send a 5 byte...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.