You have to log in to edit pages.
Fill the table below with the information required. It is important to write correctly the keywords and the categories, so that your article will be easy to find to the other users. We also recommend to click on watch this page so you will be notified every time another user modifies your tutorial page.
Click on the help buttons close to each field if you need help in filling them.
Java Advanced Java Basics Java EE Java SE Input Output Ajax Algorithms Application Servers Cryptography Databases Hibernate Debugging J2EE Debugging Design Patterns EJB Exceptions GUI Swing Loops Multithreading Networking Reflection Spring SQL Struts WebServices XDoclet XML XSLT XPath Methods Files Generics Servlets Collections Best practices Java5
Category : Java Advanced Java Basics Java EE Java SE Input Output Ajax Algorithms Application Servers Cryptography Databases Hibernate Debugging J2EE Debugging Design Patterns EJB Exceptions GUI Swing Loops Multithreading Networking Reflection Spring SQL Struts WebServices XDoclet XML XSLT XPath Methods Files Generics Servlets Collections Best practices Java5
Free text: Since JDK1.5, java.net.InetAddress.isReachable(int) can be used to check if a server is reachable or not. This example shows how to perform a pseudo ping in Java == the article == isReachable() will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host. But most Internet sites have disabled the service or blocked the requests (except some university web sites like the example above) . == ReachableTest.java == <source lang="Java">import java.io.*; import java.net.*; public class ReachableTest { public static void main(String args[]) { try { InetAddress address = InetAddress.getByName("web.mit.edu"); System.out.println("Name: " + address.getHostName()); System.out.println("Addr: " + address.getHostAddress()); System.out.println("Reach: " + address.isReachable(3000)); } catch (UnknownHostException e) { System.err.println("Unable to lookup web.mit.edu"); } catch (IOException e) { System.err.println("Unable to reach web.mit.edu"); } } }</source>[[Language::Java| ]] == See Also == [[Ping a server]], [http://www.rgagnon.com/ Real's Java How To]
Please note that all contributions to WikiJava are considered to be released under the GNU Free Documentation License 1.2 (see Project:Copyrights for details). If you don't want your writing to be edited mercilessly and redistributed at will, then don't submit it here. You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION!
Summary:
This is a minor edit Watch this page
Cancel