JavaScript - Ping Computer

April 7, 2005 at 16:47:15
Specs: XP Home SP2, Pentium 4 2.53GHz / 512MB

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


See More: JavaScript - Ping Computer

Report •


#1
April 7, 2005 at 16:58:40

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 •

#2
April 7, 2005 at 17:38:44

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 •

#3
April 7, 2005 at 17:43:45

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 •

Related Solutions

#4
April 7, 2005 at 18:45:47

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 •

#5
April 7, 2005 at 21:45:51

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 •

#6
April 7, 2005 at 22:11:00

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 •

#7
April 7, 2005 at 22:19:33

/snip
But WAIT!
/snip

I second, that's a great idea :D

---
Site of the Day


Report •

#8
April 8, 2005 at 01:34:38

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 •

#9
April 8, 2005 at 06:43:35

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 •

#10
April 8, 2005 at 08:00:39

system();

roamhosting.net


Report •

#11
April 11, 2005 at 20:00:19

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

bt more info

roamhosting.net


Report •


Ask Question