ICMP packets

From: Bob Rivers (bobrivers_at_pobox.com)
Date: 10/23/03


Date: 23 Oct 2003 08:52:12 -0700

Hi,

I was doing a research looking for Java solutions that are able to do
"ping".

I found old messages (and not so old ones), telling that Java was not
able to do that, because the API provided do not support raw sockets.
The only solution that I found was a "simulation" of a ping program
doing a UDP request to a server on port 7.

So I decided to read the API (1.4.2) and I found that the package
"java.net" is able to send ICMP packets.

Actually, and this is my question, I only found an exception that:
"Signals that an ICMP Port Unreachable message has been received on a
connected datagram."
(http://java.sun.com/j2se/1.4.2/docs/api/java/net/PortUnreachableException.html).

Well, if the package has a exception for ICMP, I can supose that now I
am able to talk ICMP using Java
(http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramSocket.html).

Am I right?

And finally: does someone did something related to this, using the new
api? Is it possible to post an example?

Thanks,

Bob Rivers
Sao Paulo - Brazil



Relevant Pages

  • Re: Windows Programming using Java
    ... > If I want to use Windows Functions through Java, ... Introduction to JNI by example using Ping by Richard Sandoz ... Then create a subdirectory called icmp. ...
    (comp.lang.java.programmer)
  • Re: ICMP packets
    ... Bob Rivers wrote: ... > I was doing a research looking for Java solutions that are able to do ... > Well, if the package has a exception for ICMP, I can supose that now I ...
    (comp.lang.java)
  • Re: Ping Class java
    ... >Does anyone know a Ping Class in Java ... >to do a simple "ping" on a server and reading the response? ... Ping is a very low level protocol not supported by Java. ...
    (comp.lang.java.programmer)
  • Re: ICMP packets
    ... > I was doing a research looking for Java solutions that are able to do ... because the API provided do not support raw sockets. ... > Well, if the package has a exception for ICMP, I can supose that now I ... If you want to get really hardcore, you can dl JPcap: ...
    (comp.lang.java)
  • Re: ICMP packets
    ... > the ICMP exception you refer to does not infer that Java can handle ICMP ... > that does not exist on a remote server, the server will return an "ICMP ...
    (comp.lang.java)