pinging a host

Hello, can anyone help me out with how to ping a host using java I dont have to use Process p=Runtime.getRuntime().exec("ping ........instead I need some powerful mechanism.. i am working on java 2 sdk 1.5.Thank you
[236 byte] By [Vive_JavaNETa] at [2007-11-27 9:57:32]
# 1
You can't.
jaxiana at 2007-7-13 0:27:49 > top of Java-index,Core,Core APIs...
# 2
Java's core APIs don't come with ICMP support. (Well, maybe in 1.6. You'd have to check the release notes.) Google for java icmp and see if you can find 3rd party support. Note that it will have to include a native portion--.dll, .so, etc.
jverda at 2007-7-13 0:27:49 > top of Java-index,Core,Core APIs...
# 3
Why do you have to ping a host using Java?Why not just try to connect to it?
ejpa at 2007-7-13 0:27:49 > top of Java-index,Core,Core APIs...
# 4

> Why do you have to ping a host using Java?

>

> Why not just try to connect to it?

Because there's overhead in establishing a TCP or UDP connection if you just want to see if the host is there.

Because you don't necessarily know which services a given host may be offering, but you might be able to assume that it will respond to icmp echo request, and you just want to see if the host is minimally "alive".

Because you might want info about number of hops or roundtrip time or packet loss that's more easily obtained through ICMP than through a TCP connection.

jverda at 2007-7-13 0:27:49 > top of Java-index,Core,Core APIs...
# 5

> Why do you have to ping a host using Java?

>

> Why not just try to connect to it?

Of course, if you're doing to do

if (ping succeeds) {

open a socket

}

then yeah, that's pointless. Just open the socket.

jverda at 2007-7-13 0:27:49 > top of Java-index,Core,Core APIs...