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.
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.
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)...
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?
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)
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.
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'"
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.
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\")?
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE