| | |
JSP - Ping a Port
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2009
Posts: 81
Reputation:
Solved Threads: 1
Hi,
I would just like to know if it's possible to ping a certain port from a jsp page.
For example:
If I had a Apache_Status.jsp on my machine and I wanted to ping it on another machine at:
123.456.78.90:8080
And I had a Glassfish_Status.jsp on my machine and I wanted to ping it on another machine at:
321.654.87.09:8484
Would this be possible?
Thanks,
-Ashton.
I would just like to know if it's possible to ping a certain port from a jsp page.
For example:
If I had a Apache_Status.jsp on my machine and I wanted to ping it on another machine at:
123.456.78.90:8080
And I had a Glassfish_Status.jsp on my machine and I wanted to ping it on another machine at:
321.654.87.09:8484
Would this be possible?
Thanks,
-Ashton.
•
•
Join Date: Jul 2009
Posts: 81
Reputation:
Solved Threads: 1
1
#2 26 Days Ago
I found code that you can use in a servlet. Something like this:
Thanks anyway! -Hope this helps someone else...
-Ashton
JSP Syntax (Toggle Plain Text)
try { String ip = "127.0.0.1"; Process p = Runtime.getRuntime().exec("ping -n 1 " + ip); int status = p.waitFor(); System.out.println(ip + " is " + (status == 0 ? "alive" : "dead")); }//end try catch (Throwable t) { t.getMessage(); }
Thanks anyway! -Hope this helps someone else...
-Ashton
Last edited by AshtonHogan; 26 Days Ago at 2:48 pm.
![]() |
Similar Threads
- Programmatically finding IP, Port & Server State of Weblogic (JSP)
- how to write java program which sholuld be able to send sms messages to mobile (Java)
- ping is not successful. (Java)
- wrong ip? (Domains and DNS)
- internet is fine but cant ping (Networking Hardware Configuration)
Other Threads in the JSP Forum
- Previous Thread: (newline) problem with in text file
- Next Thread: XML parsing in JSP
| Thread Tools | Search this Thread |
3g 3gs ajax aliens apache app apple application army banking broadband building capacity combobox connection cpanel cron data database dual engineering fail frames frameworks glassfish government hacking headmethod hsbc ibm integer internet iphone java javaee javascript jsf jsp kids linux microsoft mobile mod_rewrite mvc2 mvcmodel2 mysql network news o2 officefileformats opensource oracle parameters passing passwords persuade php ping poi protocol provider redirect request.getparameter response runtime safety school scriptlets security server servlet sessions seti shutdown() sms social sockets software solaris space ssl sun technology terrorism tomcat tutorial uk virtualbox web win32 winsock wireless






