This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 24183

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]
    Consider Paul's rocket mass heater.
    subject: Pinging In Java
    Similar Threads
    Design pattern for sorting nested arraylists
    Overriden method throwing Exception.
    SQL Server 2005 Connection using SQL Explorer 3.5 in Eclipse
    ping a website