View Full Version : Challenge for the know-it-alls

04-17-2003, 07:09 AM
I need a JavaScript or preety much any script for that matter, that can scan an IP including the port so for example = I need the script to check if that IP and port are responding and write "Yes" or "NO" when the results are in. This should be a good challenge, i tried myself but I'm not that good. Can anyone show me up?

04-17-2003, 07:39 AM
Doing this with javascript is like visiting codingforums w/o an internet connection.

Hint: impossible

04-17-2003, 07:41 AM
#1) You need to read the posting guidelines to know that your subject line sucks.

#2) To show the IP and Port, you could use PHP:


Unfortunately, PHP and JavaScript can't share variable values, so you'll have to modify this snippet to send the values to hidden form inputs, submit the form, via GET, to a new PHP page, and parse the URL with JavaScript to determine what IP and Port are being used.

I'm going to bed, so I'm not going to write anything more right now. I suggest you check out PHP.net for documentation, and then learn how to parse URLs with JavaScript.


04-17-2003, 07:50 AM
yes, i realized my topic mistake after i posted. I have actually seen a few script that do this, minus the port, but didn't work. I could use php but I want to see If there is any better way that I can still use in HTML.

04-17-2003, 09:10 AM
Eh? Do you actually know what a server side language is? It returns Html (not always).

04-17-2003, 10:59 AM
Let me guess you are trying to do that stuff that you get saying what IP and OS you are using, to make you get some software you actaully have no need for, as you already do have one of the best firewalls out there.

Anyway this is in the wrong forum.

04-17-2003, 04:07 PM
I use an img tag to pull something that I know exists from my target, and JavaScript to pull something from my own machine if the img from the target fails. Maybe you could build from this:

<script type="text/javascript">
&nbsp;Now=new Date();
&nbsp;Out ='<img src="http://target.com/green.gif';
&nbsp;Out+='" onerror="this.src=\'red.gif\'"/>\n';

04-17-2003, 04:14 PM
That will never let him ping an IP and see if it responds.

Sorry, Javascript just doesn't have the capacity for this task.

04-17-2003, 04:19 PM
beetle, you are correct that my code is not a general solution to the problem. But, if he knows an image file that should be returned when the server at that address and port is working properly, then he could still get an indication of whether it is up or down.