File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Pinging In Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Pinging In Java" Watch "Pinging In Java" New topic

Pinging In Java

Murat Balkan
Ranch Hand

Joined: Sep 10, 2002
Posts: 127
Hi ,
Is there a way to ping in java.?
I need to have echo response times of some addresses but I could not find a spesific class that does ping.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Ping is implemented using a low-level protocol named ICMP, and Java doesn't support it directly. You have three choices:
  • Use the UDP 'echo' protocol or something similar instead of real 'ping', like this applet;
  • Execute an external 'ping' program using Runtime.exec(); or
  • Use JNI to interface to native code that implements ICMP ping.

  • [Jess in Action][AskingGoodQuestions]
    wood burning stoves
    subject: Pinging In Java
    It's not a secret anymore!