• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pinging In Java

 
Murat Balkan
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks
Murat
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic