473,813 Members | 3,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to measure the ping time between the visitor and my website ??

hello !

I would like to measure the time a user needs to connect to my website.
In other words, to perform a ping between my website and the user's
computer.

I'm scratching my head as to how i can do that. Does anyone know a good way
to make this happen?

thanks a lot,

alexandre
Jul 17 '05 #1
14 5679
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
hello !

I would like to measure the time a user needs to connect to my website.
In other words, to perform a ping between my website and the user's
computer.

I'm scratching my head as to how i can do that. Does anyone know a good way to make this happen?

thanks a lot,

alexandre

Here you go
<?
$ip = $_SERVER['REMOTE_ADDR'];
$res = `ping -c 1 $ip`;

list($n,$r) = explode("packet loss, ",$res);
list($pTime,$n) = explode("ms",$r );
print "Ping time $pTime ms";
?>

you can test it here:
http://gzen.myhq.info/test/ping.php
Ok, now several things wrong with this, first, this will only work if ping
packets are allowed through the entire netork from you to them, inside thier
network if they are in say a corporate building. Now if they are behind a
firewall, you will only get times to the firewall. (depends on firewall, but
most likely, firewall times)

Now, this also assumes they dont have any type of stupid software like
black-ice, (sorry to offend, but if you have a software firewall installed
on the machine you are trying to protect, your an idiot, get a solution
before the machine you are protect!) -- ok sorry about that

Also, the route that someone uses to send packets to you is not nessasarily
the route the packets take from you to them. For example. At one of my data
centers, outgoing data is routed through the least congested pipe.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools

Jul 17 '05 #2
thanks a lot mike.

I'm gettting 0 ms all the time. Is that normal ?
Also, would this work on a virtual server? I heard Virtual servers don't
let you execute commands with php, as you could use it to execute "rm -rf /"
or other bad things. So, they set this in their php.ini.
What do you think ?

thanks again,

alexandre
PS: nice website :)

"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:jK******** ********@newssv r29.news.prodig y.com...
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
hello !

I would like to measure the time a user needs to connect to my website.
In other words, to perform a ping between my website and the user's
computer.

I'm scratching my head as to how i can do that. Does anyone know a good way
to make this happen?

thanks a lot,

alexandre


Here you go
<?
$ip = $_SERVER['REMOTE_ADDR'];
$res = `ping -c 1 $ip`;

list($n,$r) = explode("packet loss, ",$res);
list($pTime,$n) = explode("ms",$r );
print "Ping time $pTime ms";
?>

you can test it here:
http://gzen.myhq.info/test/ping.php
Ok, now several things wrong with this, first, this will only work if ping
packets are allowed through the entire netork from you to them, inside

thier network if they are in say a corporate building. Now if they are behind a
firewall, you will only get times to the firewall. (depends on firewall, but most likely, firewall times)

Now, this also assumes they dont have any type of stupid software like
black-ice, (sorry to offend, but if you have a software firewall installed on the machine you are trying to protect, your an idiot, get a solution
before the machine you are protect!) -- ok sorry about that

Also, the route that someone uses to send packets to you is not nessasarily the route the packets take from you to them. For example. At one of my data centers, outgoing data is routed through the least congested pipe.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools


Jul 17 '05 #3
The test on my server, is a virual host, I have around 65 virtuals on that
server
rm -fr will only work on files that are the same owner/group permission
as far as 0ms, not sure, you must be realy, realy, close to me, but I didnt
see you at the office coffee maker :)

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
thanks a lot mike.

I'm gettting 0 ms all the time. Is that normal ?
Also, would this work on a virtual server? I heard Virtual servers don't
let you execute commands with php, as you could use it to execute "rm -rf /" or other bad things. So, they set this in their php.ini.
What do you think ?

thanks again,

alexandre
PS: nice website :)

"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:jK******** ********@newssv r29.news.prodig y.com...
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
hello !

I would like to measure the time a user needs to connect to my website. In other words, to perform a ping between my website and the user's
computer.

I'm scratching my head as to how i can do that. Does anyone know a
good way
to make this happen?

thanks a lot,

alexandre


Here you go
<?
$ip = $_SERVER['REMOTE_ADDR'];
$res = `ping -c 1 $ip`;

list($n,$r) = explode("packet loss, ",$res);
list($pTime,$n) = explode("ms",$r );
print "Ping time $pTime ms";
?>

you can test it here:
http://gzen.myhq.info/test/ping.php
Ok, now several things wrong with this, first, this will only work if ping packets are allowed through the entire netork from you to them, inside

thier
network if they are in say a corporate building. Now if they are behind a firewall, you will only get times to the firewall. (depends on firewall,

but
most likely, firewall times)

Now, this also assumes they dont have any type of stupid software like
black-ice, (sorry to offend, but if you have a software firewall

installed
on the machine you are trying to protect, your an idiot, get a solution
before the machine you are protect!) -- ok sorry about that

Also, the route that someone uses to send packets to you is not

nessasarily
the route the packets take from you to them. For example. At one of my

data
centers, outgoing data is routed through the least congested pipe.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools



Jul 17 '05 #4
look! behind you !

*-]
rm -fr will only work on files that are the same owner/group permission i assume you are talking about the chmod parameters. i'll experiment with
that and see what happens.

thanks,

alex

"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:bw******** *********@newss vr29.news.prodi gy.com...
The test on my server, is a virual host, I have around 65 virtuals on that
server
rm -fr will only work on files that are the same owner/group permission
as far as 0ms, not sure, you must be realy, realy, close to me, but I didnt see you at the office coffee maker :)

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
thanks a lot mike.

I'm gettting 0 ms all the time. Is that normal ?
Also, would this work on a virtual server? I heard Virtual servers don't let you execute commands with php, as you could use it to execute "rm -rf
/"
or other bad things. So, they set this in their php.ini.
What do you think ?

thanks again,

alexandre
PS: nice website :)

"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:jK******** ********@newssv r29.news.prodig y.com...
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
> hello !
>
> I would like to measure the time a user needs to connect to my
website. > In other words, to perform a ping between my website and the user's
> computer.
>
> I'm scratching my head as to how i can do that. Does anyone know a good way
> to make this happen?
>
> thanks a lot,
>
> alexandre
>

Here you go
<?
$ip = $_SERVER['REMOTE_ADDR'];
$res = `ping -c 1 $ip`;

list($n,$r) = explode("packet loss, ",$res);
list($pTime,$n) = explode("ms",$r );
print "Ping time $pTime ms";
?>

you can test it here:
http://gzen.myhq.info/test/ping.php
Ok, now several things wrong with this, first, this will only work if ping packets are allowed through the entire netork from you to them, inside

thier
network if they are in say a corporate building. Now if they are behind a
firewall, you will only get times to the firewall. (depends on

firewall, but
most likely, firewall times)

Now, this also assumes they dont have any type of stupid software like
black-ice, (sorry to offend, but if you have a software firewall

installed
on the machine you are trying to protect, your an idiot, get a

solution before the machine you are protect!) -- ok sorry about that

Also, the route that someone uses to send packets to you is not

nessasarily
the route the packets take from you to them. For example. At one of my

data
centers, outgoing data is routed through the least congested pipe.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools

>



Jul 17 '05 #5
on my virtual server, i don't even get the "0" ms. it just returns "Ping
time ms".
i tried different chmod configs, with same owner/group params, to no avail.

??
"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:bw******** *********@newss vr29.news.prodi gy.com...
The test on my server, is a virual host, I have around 65 virtuals on that
server
rm -fr will only work on files that are the same owner/group permission
as far as 0ms, not sure, you must be realy, realy, close to me, but I didnt see you at the office coffee maker :)

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
thanks a lot mike.

I'm gettting 0 ms all the time. Is that normal ?
Also, would this work on a virtual server? I heard Virtual servers don't
let you execute commands with php, as you could use it to execute "rm -rf
/"
or other bad things. So, they set this in their php.ini.
What do you think ?

thanks again,

alexandre
PS: nice website :)

"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:jK******** ********@newssv r29.news.prodig y.com...
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...
> hello !
>
> I would like to measure the time a user needs to connect to my
website. > In other words, to perform a ping between my website and the user's
> computer.
>
> I'm scratching my head as to how i can do that. Does anyone know a good way
> to make this happen?
>
> thanks a lot,
>
> alexandre
>

Here you go
<?
$ip = $_SERVER['REMOTE_ADDR'];
$res = `ping -c 1 $ip`;

list($n,$r) = explode("packet loss, ",$res);
list($pTime,$n) = explode("ms",$r );
print "Ping time $pTime ms";
?>

you can test it here:
http://gzen.myhq.info/test/ping.php
Ok, now several things wrong with this, first, this will only work if ping packets are allowed through the entire netork from you to them, inside

thier
network if they are in say a corporate building. Now if they are behind a
firewall, you will only get times to the firewall. (depends on

firewall, but
most likely, firewall times)

Now, this also assumes they dont have any type of stupid software like
black-ice, (sorry to offend, but if you have a software firewall

installed
on the machine you are trying to protect, your an idiot, get a

solution before the machine you are protect!) -- ok sorry about that

Also, the route that someone uses to send packets to you is not

nessasarily
the route the packets take from you to them. For example. At one of my

data
centers, outgoing data is routed through the least congested pipe.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools

>



Jul 17 '05 #6
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** **************@ news.skynet.be. ..
on my virtual server, i don't even get the "0" ms. it just returns "Ping
time ms".
i tried different chmod configs, with same owner/group params, to no avail.
??

hmm, I will look into this a bit, becouse it was raised some questions/ideas
in my head.
what can you tell me about the server, OS, httpd server (apache?), versions
etc??

(I turned around, and I saw you walk out to get check your server info, I
must say, that is a nice sweater your wearing, holiday x-mas gift?)
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #7
nah, funny you noticed my sweater... And not the tiger skin string i've been
wearing since the evening of december 31 until, well, now !
....oh, and you don't want to know about that sweater...
*-]

provider: onyxservers.com
OS: linux
server: apache=../apache_1.3.26-fp_2002'
php version: 4.2.3
php info: http://www.geodevlamynck.be/test/phpinfo.php

anything else ?

thanks a lot,

Alexandre

test url: http://www.geodevlamynck.be/test/alexping.php
"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:8O******** *********@newss vr29.news.prodi gy.com...
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** **************@ news.skynet.be. ..
on my virtual server, i don't even get the "0" ms. it just returns "Ping
time ms".
i tried different chmod configs, with same owner/group params, to no avail.

??

hmm, I will look into this a bit, becouse it was raised some

questions/ideas in my head.
what can you tell me about the server, OS, httpd server (apache?), versions etc??

(I turned around, and I saw you walk out to get check your server info, I
must say, that is a nice sweater your wearing, holiday x-mas gift?)
Mike Bradley
http://gzen.myhq.info -- free online php tools

Jul 17 '05 #8
i forgot to give you the test link:
http://www.geodevlamynck.be/test/alexping.php
"CountScubu la" <me@scantek.hot mail.com> wrote in message
news:8O******** *********@newss vr29.news.prodi gy.com...
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** **************@ news.skynet.be. ..
on my virtual server, i don't even get the "0" ms. it just returns "Ping
time ms".
i tried different chmod configs, with same owner/group params, to no avail.

??

hmm, I will look into this a bit, becouse it was raised some

questions/ideas in my head.
what can you tell me about the server, OS, httpd server (apache?), versions etc??

(I turned around, and I saw you walk out to get check your server info, I
must say, that is a nice sweater your wearing, holiday x-mas gift?)
Mike Bradley
http://gzen.myhq.info -- free online php tools

Jul 17 '05 #9
"Alexandre Plennevaux" <al*******@la b-au.com> wrote in message
news:3f******** *************** @news.skynet.be ...

provider: onyxservers.com
OS: linux
server: apache=../apache_1.3.26-fp_2002'
php version: 4.2.3
php info: http://www.geodevlamynck.be/test/phpinfo.php

anything else ?
thanks a lot,
Alexandre


try this:
you can test it here: http://www.gzentools.com/test/ttouser.php or
http://gzen.myhq.info/test/ttouser.php

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$s = microtime();
$fp = fsockopen("tcp://$ip", 1, $errno, $errstr);
$e = microtime();

$tt = $e-$s;

if ($fp)
fclose($fp);

print "Trip time: $tt ms\n";

?>

This tries to open a socket connection to the users machine (or firewall, as
I stated before), to port 1, which should not be open, if it should open, it
will close the connection, either way, it will time the proccess, since this
is not ping, we are only talking about a slight differnce of a few
milliseconds, so does it matter?

we can call this Fuzzy Ping ;)

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #10

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

Similar topics

10
4761
by: Yang Li Ke | last post by:
Hi guys, Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then using session vars to check time out ... Anyone has any ideas about doing that kind of script? Thank you! -- Yang
1
7876
by: Mike Mallory | last post by:
Can Java perform two pings at one time and display the best ping time with the best result? Also, can Java perform two trace routes at one time and display the trace with the fewest hops? Thank you for your help. Mike
0
2067
by: Dave | last post by:
Hi I have tried to use PathPing, Ping etc to determine the rate of transfer of data between my machine and the database server. However I know that the transfer rate is slower due to the time it takes to ping when my computer is requesting a lot of data from the Db but no statistics to say things are 2 times slower. I would like to do this with a c++ program. I am trying to argue that is worth the money to upgrade our switches
14
42896
by: Egil Hansen | last post by:
Hi I'm wondering if its possible to write a javascript, that can ping a ip and return the average round trip time (like ping in dos/linux)? Regards, Egil.
2
1753
by: Hari | last post by:
Hi, How can I find out what site a visitor has come from using ASP? Suppose my website is sample.com and I have one page in the website that is used by the visitor to request products and demo. And on each request that page will send email to webmaster with the URL of the site that the visitor has come from. Like if the visitor will search in Google and click on the link that will take him to the home page not the product request page,...
5
5593
by: Deepak | last post by:
I am programing a ping application which pings various centers . I used timer loop and it pings one by one. Now when i finish pinging one center it should wait for the ping_completed function to be executed and then continue pinging another certer. The ping_completed function is called on completion of ping by the os and i have no control on it .
1
18517
by: Krish | last post by:
All, I have an offline application that works online for some data syncronization. For data syncronization I access a webservice. I want to show whether my application is online or not by checking whether the application is able to access the webservice. If the webservice is accessible, the application is online. otherwise it is offline What is the best way to ping a url in C# ?
8
9814
by: TKowalcz | last post by:
Hello. I have a problem. I need to make a client-server application using sockets (easy). After they communicate server store information about client (IP, and some data). Later on i need to check if the client is connected (ive got his IP and need to ping him). I dont need to write whole ping function - just need a return value :). Ive googled but didnt find anything :(. Could someone help - how can i
3
5770
by: nagota | last post by:
Hi I want to load some xml data from the server running on mymachine (localhost), from a flash swf embedded on an external website. The localhost has crossdomain.xml as well, but the problem is its not always running. So in case its not running I want to get some error code, so that i can ping again after some time. I use this code.. function loadMyXML() { getDeviceId_xml = new XML(); getDeviceId_xml.ignoreWhite = true; ...
0
9734
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
10406
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
10420
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
10139
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9221
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
7681
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
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3029
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.