Java Ping

The change list for Java 1.5.0 (still in beta) caught my eye, specifically, in the networking enhancements section. Looks like they've finally added the ability to "ping" a remote host and determine reachability. Apparently, the InetAddress.isReachable() method works using an ICMP echo or by attempting a TCP connection to the Echo service. Previously, you couldn't make use of an ICMP echo within Java because there was no support for creating RAW sockets. Granted, you could use exec() to run the ping command and then parse the output, but this just seems a bit kludgy.

I was hoping that this development would allow me to get MultiPing to a point where I could release something.

Well, as it turns out, there's a known bug in the current beta release. The InetAddress.isReachable() method method leaks sockets in windows (the code never closes the socket used in the operation).

So, after running MultiPing for awhile and periodically using this, the call starts failing as the OS refuses to create new sockets. Apparently, according to the bug report it messes up other networking functionality on the machine as well :-(

The bug report mentioned before indicates that this has been fixed in tiger-rc. Currently the latest posted snapshot (build 56) does not contain a fix.

Something to look forward to though...


Post a Comment

<< Home