Computing.Net > Forums > Web Development > JavaScript - Ping Computer

JavaScript - Ping Computer

Reply to Message Icon

Original Message
Name: RTAdams89
Date: April 7, 2005 at 16:47:15 Pacific
Subject: JavaScript - Ping Computer
OS: XP Home SP2
CPU/Ram: Pentium 4 2.53GHz / 512MB
Comment:

Hello all. Is there any way to use javascript to ping an IP address? Please note that I need to be able to determine if a computer (ip address) is on-line with out that computer runnign a web server or such.

-Ryan Adams


Report Offensive Message For Removal

Response Number 1
Name: Michael J (by mjdamato)
Date: April 7, 2005 at 16:58:40 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

You can't do it through client-side sript. And even with server-side script (if your host handles that) I don't know of a way to do it. I think a more robust server-side scripting language, such as VBScript or PHP, might be able to do it.

Michael J


Report Offensive Follow Up For Removal

Response Number 2
Name: Laler
Date: April 7, 2005 at 17:38:44 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

and if it's personal computers then I think the default settings of XP SP2 and other standard firewall is ignoring icmps? so it's a bit unreliable...

so, without asking them to install a webserver, you can also check for IMs the computer use, there're some tutorials on doing this (testing if someone's Y!m, AOL, MSN, ICQ is online)...

you still need serverside scripting though

---
Site of the Day


Report Offensive Follow Up For Removal

Response Number 3
Name: RTAdams89
Date: April 7, 2005 at 17:43:45 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

Well it's for my home network. I have a web page stored on a network drive that all the other PCs access as their homepage. I want to incorperate a script into the webpage that will show which of my PCs are curently connected. Perhaps a Java applet?

-Ryan Adams


Report Offensive Follow Up For Removal

Response Number 4
Name: Laler
Date: April 7, 2005 at 18:45:47 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

this homepage is in a webserver or just a html page in a network drive? if it's a webserver (and nothing much to lose to install one) then enable php in it, only 1MB for the IIS webserver (standard server found in win XP CD)...

it'll be more resource friendly than a java applet and lots of people here can help you with the ping script (as now icmp ignoring is no longer an issue)

:D

---
Site of the Day


Report Offensive Follow Up For Removal

Response Number 5
Name: Michael J (by mjdamato)
Date: April 7, 2005 at 21:45:51 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

I'd suggest the same thing. Either install PHP or IIS (which allows ASP (server-side VBScript and JavaScript)

I actually started the same kind of thing a while back but got side tracked. I have a page on my home webserver that has an icon for each of the computers in my home that shows if the computer is on or not. If it is on, I was going to have a link to Remote Desktop to the computer. This was in VBScript. I'll see if I can did anything up.


Michael J


Report Offensive Follow Up For Removal


Response Number 6
Name: Michael J (by mjdamato)
Date: April 7, 2005 at 22:11:00 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

Ok, here are a couple of resources:

Article Ping From ASP This is a tutorial using a batch file with ASP

This is a download of a DLL file that will allow you to ping within VBScript without an external bat file.

But WAIT! I just had another idea. Why don't you just create a folder on each computer with an image (I'd use a transparetn GIF). Then map each of those folders to your server. Then your HTML page could try to load each of the images - there is a javascript onError event handler to tell if there was an error loading an image. You could use that as the trigger to determine if the computer was on or not. Just put the following into the image tag "onError='js function or code'"

Michael J


Report Offensive Follow Up For Removal

Response Number 7
Name: Laler
Date: April 7, 2005 at 22:19:33 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

/snip
But WAIT!
/snip

I second, that's a great idea :D

---
Site of the Day


Report Offensive Follow Up For Removal

Response Number 8
Name: Michael J (by mjdamato)
Date: April 8, 2005 at 01:34:38 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

Just shows that it's important to provide as much detail as possible. Had we known that he was trying to ping local computers, this could have been a much shorter thread.

Michael J


Report Offensive Follow Up For Removal

Response Number 9
Name: RTAdams89
Date: April 8, 2005 at 06:43:35 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

Well like I said it's on a network drive (a Linksys NSLU2) which is not a computer and can't run a web server or such on it. I was going to use the image idea originally, however, will javascript work ok if the image URL is actually network link ( such as "\\computername\shared\")?

-Ryan Adams


Report Offensive Follow Up For Removal

Response Number 10
Name: Jamie_McCoy
Date: April 8, 2005 at 08:00:39 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

system();

roamhosting.net


Report Offensive Follow Up For Removal

Response Number 11
Name: Jamie_McCoy
Date: April 11, 2005 at 20:00:19 Pacific
Subject: JavaScript - Ping Computer
Reply: (edit)

http://uk.php.net/manual/en/function.system.php

bt more info

roamhosting.net


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: JavaScript - Ping Computer

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software