473,721 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect connection speed

Usenet,

I am currently working on my website and am needing to detect the
connection speed of the client. I would like to do this in PHP and not
use any other languages. This makes it a bit more complicated. I know
it is possiable to do this in PHP but I can't think of how.

All I need to figure out is if they are on dial up or not. It doesn't
have to be 100% accurate but at least 50% accurate. Any help is greatly
appreciated.

Jordan

Jul 17 '05 #1
13 7436
In article <11************ **********@f14g 2000cwb.googleg roups.com>,
Jo*********@gma il.com wrote:
I am currently working on my website and am needing to detect the
connection speed of the client. I would like to do this in PHP and not
use any other languages. This makes it a bit more complicated. I know
it is possiable to do this in PHP but I can't think of how.

All I need to figure out is if they are on dial up or not. It doesn't
have to be 100% accurate but at least 50% accurate. Any help is greatly
appreciated.


Unless you setup some sort of client/server program where the client can
be downloaded to the client browser, run where it connects to the
server, then disconnects, I don't see a way to do this with PHP. Java,
yes. But not PHP.

--
DeeDee, don't press that button! DeeDee! NO! Dee...

Jul 17 '05 #2
If it doesn't have to be 100% accurate, why not just ask the user if
they're on broadband or dialup?

Jo*********@gma il.com wrote in news:1112656179 .236197.282160
@f14g2000cwb.go oglegroups.com:
Usenet,

I am currently working on my website and am needing to detect the
connection speed of the client. I would like to do this in PHP and not
use any other languages. This makes it a bit more complicated. I know
it is possiable to do this in PHP but I can't think of how.

All I need to figure out is if they are on dial up or not. It doesn't
have to be 100% accurate but at least 50% accurate. Any help is greatly
appreciated.

Jordan


Jul 17 '05 #3
Hi there,

Have you thought of javascript?

<script type="text/javascript">
counter = 0;
modemNeedsThisM anyMiliseconds = 700;

tempImageOf100K bs = new Image();
tempImageOf100K bs.onload = function() { window.clearInt erval(
milisecondCount er ); ( counter < modemNeedsThisM anyMiliseconds ) ?
window.location .href = "broadband.html " : window.location .href =
"modem.html "}
milisecondCount er = window.setInter val( "counter++" , 1 );
tempImageOf100K bs.src = "http://www.yoursite.co m/image.jpg";
</script>

The long line does all the job, and apart from looking ugly it works.
Of course you'll need to figure out the value of the
modemNeedsThisM anyMiliseconds variable...

Also you may need to put some variable string in the image
(image.jpg?code =kdmkdfmsfsd) so that browser doesn't use cache!

I hope I gave you a hint in solving your problems...

- Evanescent Lurker -

Jul 17 '05 #4
ev************* **@gmail.com napisa³:
Hi there,

Have you thought of javascript?

<script type="text/javascript">
counter = 0;
modemNeedsThisM anyMiliseconds = 700;

tempImageOf100K bs = new Image();
tempImageOf100K bs.onload = function() { window.clearInt erval(
milisecondCount er ); ( counter < modemNeedsThisM anyMiliseconds ) ?
window.location .href = "broadband.html " : window.location .href =
"modem.html "}
milisecondCount er = window.setInter val( "counter++" , 1 );
tempImageOf100K bs.src = "http://www.yoursite.co m/image.jpg";
</script>

The long line does all the job, and apart from looking ugly it works.
Of course you'll need to figure out the value of the
modemNeedsThisM anyMiliseconds variable...

Also you may need to put some variable string in the image
(image.jpg?code =kdmkdfmsfsd) so that browser doesn't use cache!


And instead of loading broadand.html or modem.html you could just make a
form on the page
<FORM name='connform' method='post' blahblahblah>
<INPUT type='hidden' name='connectio n' value=''>
</FORM>

and

[pseudo-code]
document.forms. connform.connec tion='broadband '
(or document.forms. connform.connec tion='modem')
document.forms. connform.submit ()
[/pseudo-code]

this way you can have the info on a single page.

Cheers
Mike
Jul 17 '05 #5
ev************* **@gmail.com wrote:
Hi there,

Have you thought of javascript?

<script type="text/javascript">
counter = 0;
modemNeedsThisM anyMiliseconds = 700;

tempImageOf100K bs = new Image();
tempImageOf100K bs.onload = function() { window.clearInt erval(
milisecondCount er ); ( counter < modemNeedsThisM anyMiliseconds ) ?
window.location .href = "broadband.html " : window.location .href =
"modem.html "}
milisecondCount er = window.setInter val( "counter++" , 1 );
tempImageOf100K bs.src = "http://www.yoursite.co m/image.jpg";
</script>


Nice function! :-)
One 'but':
Be sure to run this function AFTER the page loaded, otherwise all other kind
of downloads can interfere with the speed,

Regards,
Erwin Moller

Jul 17 '05 #6
Or even simpler, he can replace:

window.location .href = "broadband.html " : window.location .href =
"modem.html "

with

window.location .href += "?speed=broadba nd" : window.location .href +=
"?speed=mod em"

? can be replaced with & if needed... and fetch them with $_GET in php
:)

Also you must consider what Erwin Moller wrote... I've thought of it as
an empty page which redirects, hence only my code would be loaded, but
if you bundle it with everything else there is a problem...

Jul 17 '05 #7
ev************* **@gmail.com (ev************ ***@gmail.com) wrote:
: Hi there,

: Have you thought of javascript?

: <script type="text/javascript">
: counter = 0;
: modemNeedsThisM anyMiliseconds = 700;

: tempImageOf100K bs = new Image();
: tempImageOf100K bs.onload = function() { window.clearInt erval(
: milisecondCount er ); ( counter < modemNeedsThisM anyMiliseconds ) ?
: window.location .href = "broadband.html " : window.location .href =
: "modem.html "}
: milisecondCount er = window.setInter val( "counter++" , 1 );
: tempImageOf100K bs.src = "http://www.yoursite.co m/image.jpg";
: </script>

: The long line does all the job, and apart from looking ugly it works.
: Of course you'll need to figure out the value of the
: modemNeedsThisM anyMiliseconds variable...

I wonder how long it takes a 14.4 modem to download the 100Kbs image used
to test the speed of the connection.
--

This space not for rent.
Jul 17 '05 #8
Malcolm Dew-Jones napisa³:
ev************* **@gmail.com (ev************ ***@gmail.com) wrote:
: Hi there,

: Have you thought of javascript?

: <script type="text/javascript">
: counter = 0;
: modemNeedsThisM anyMiliseconds = 700;

: tempImageOf100K bs = new Image();
: tempImageOf100K bs.onload = function() {
: window.clearInt erval(
: milisecondCount er ); ( counter < modemNeedsThisM anyMiliseconds ) ?
: window.location .href = "broadband.html " : window.location .href =
: "modem.html "}
: milisecondCount er = window.setInter val( "counter++" , 1 );
: tempImageOf100K bs.src = "http://www.yoursite.co m/image.jpg";
: </script>

: The long line does all the job, and apart from looking ugly it works.
: Of course you'll need to figure out the value of the
: modemNeedsThisM anyMiliseconds variable...

I wonder how long it takes a 14.4 modem to download the 100Kbs image
used to test the speed of the connection.

Hmmmm... I guess you could always try and test it. :)
A 14.4 modem downloads 14.4 Kb per second, that means ~1.6 KBps, which
gives us 100 / 1.5 (not 1.6 - let's assume some overhead) = ~67s.
But test it anyway. :)

Cheers
Mike
Jul 17 '05 #9
=?ISO-8859-2?Q?Micha=B3_Wo =BCniak?= (mikiwoz_remove _this@yahoo_rem ove_this.co.uk) wrote:
: Malcolm Dew-Jones napisa³:

: > ev************* **@gmail.com (ev************ ***@gmail.com) wrote:
: > : Hi there,
: >
: > : Have you thought of javascript?
: >
: > : <script type="text/javascript">
: > : counter = 0;
: > : modemNeedsThisM anyMiliseconds = 700;
: >
: > : tempImageOf100K bs = new Image();
: > : tempImageOf100K bs.onload = function() {
: > : window.clearInt erval(
: > : milisecondCount er ); ( counter < modemNeedsThisM anyMiliseconds ) ?
: > : window.location .href = "broadband.html " : window.location .href =
: > : "modem.html "}
: > : milisecondCount er = window.setInter val( "counter++" , 1 );
: > : tempImageOf100K bs.src = "http://www.yoursite.co m/image.jpg";
: > : </script>
: >
: > : The long line does all the job, and apart from looking ugly it works.
: > : Of course you'll need to figure out the value of the
: > : modemNeedsThisM anyMiliseconds variable...
: >
: > I wonder how long it takes a 14.4 modem to download the 100Kbs image
: > used to test the speed of the connection.
: >
: Hmmmm... I guess you could always try and test it. :)

Oh dear do I have to?

: A 14.4 modem downloads 14.4 Kb per second, that means ~1.6 KBps, which
: gives us 100 / 1.5 (not 1.6 - let's assume some overhead) = ~67s.
: But test it anyway. :)

Oh look, I don't have to test it because some nice person has just made a
very reasonable looking ball park estimate - it could take around a
minute.

A 56 K modem might therefore take about 15 seconds (very rough estimate).

Actually you do need to test it because part of the modem's speed comes
from data conmpression, which works less well on pre-compressed data (i.e.
jpeg images), so the speed could be slower than estimated.

(And of course you should test it anyway - the above is just to check
whether the approach is reasonable enough to be worth testing.)

Personally I preferred the suggestion to ask the user for their
preferences. Imagine if everybody's home page started testing the
connection speed using this technique.

In some settings the javascript might be very useful, so this is not meant
to sound derogatory in any way, just things to think about before you use
it.
--

This space not for rent.
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
23062
by: Yang Li Ke | last post by:
Hi guys, Is it possible to know the internet speed of the visitors with php? Thanx -- Yang
5
3313
by: chris | last post by:
hi all, is there a way that a script can detect the connection speed of a visitor, so that I can direct slower connection to a standard site and faster DSL/cable users to a flash copy of the site etc. thanks in advance
12
2617
by: Alban Hertroys | last post by:
Good day, I have a number of threads doing inserts in a table, after which I want to do a select. This means that it will occur that the row that I want to select is locked (by the DB). In these cases, I believe I receive an OperationalError (or is it an InterfaceError?). Is it possible (and if so - how?) to verify that the exception occured because of row locking, so that I can wait and try again?
1
3353
by: ripken95 | last post by:
I connect to the internet through ADSL. I want to write the web page which can detect the connection status with javascript. This detection is like the signal detection in the mobile phone. If the signal is weak, the status may have one squares or zero on the phone. How could I do if I want to detect the status of the network? Thx and Best Regards.
32
4278
by: Victor | last post by:
I've been to a few websites where it displays the town, state (if USA), country I'm browsing from. Now, I know that detecting country is easy, but how do you determine the town? What ASP components do this? Thanks, Bill.
4
3852
by: Frank Meng | last post by:
Hi. I am trying a csharp sample from http://www.codeproject.com/csharp/socketsincs.asp . (Sorry I didn't post all the source codes here, please get the codes from above link if you want to try). I had some troubles when I started 6 threads (each thread made a separate connection) and sent messages to same server simultaneously. Sometimes, not always, the socket looks like ok, but really it is dead. I don't why it happens.
13
2430
by: Shailesh Humbad | last post by:
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? I am sending a large file to the client, and I want to record how many bytes are actually sent. I can detect abort of the script using a shutdown handler. In the shutdown handler, I tried ob_get_length, but it returns false. I tried to read the server's log file, but it is does not contain the...
0
1393
by: Arthur | last post by:
Hi, I am trying to write a windows service in VC++.NET 2003, the task of this server is to detect the kind of internet connection and if there is a connection send some file and do something. I have found a method calls InternetGetConnectedState() in .net, this returns false or true for connection also this one has flags and you can use them to know what kind of connection machine uses. But here is my problem: suppose you don't have...
1
1840
by: Arielle | last post by:
I wasn't sure where to put this but anyway here's the idea and I'm wondering if it's possible. Help would be appreciated but if anyone has done this before regardless I can eventually figure it out I just don't want to waste effort on the impossible. I want to basically detect a visitor's connection speed when they come to my website in order to determine which "version" to forward them to. I have one that is a little media intense...
0
8851
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8736
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9227
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9142
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6676
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4493
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4761
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2137
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.