Hi socket programmers, While writing mbeans to interface with legacy tcp/ip hosts, I often thought it would be really usefull to be able to "ping" them.
[[ As you surely know "ping" is icmp based, and jdks up to 1.4 don't support icmp sockets. Even if you write some jni code you are urged to run the whole jvm as root if running under unix, which you might not prefer to do; these security nightmares are probably the main reason for sun not to include icmp in the standard. (OTOH: there exists a jni icmp implementation for winsocks.) Now you could work around this by exec()-ing the ping utility of your favourite os. This is: 1) not so cheap (ressource wise, at least an exec() per ping) 2) quite slow (most ping utilities can only ping one host at a time and only once per second) 3) not so portable, you'll have to setup arguments and parse results in a way depending on your "ping" variant. ]] I came up with this solution: I wrote a very small C programm which acts as a gateway between a special udp socket and an icmp raw socket. So the java thread sends udp packets to that port, they get resend as icmp packets, the remote side responds, the response is translated back to udp and the java thread can read them. This is quite cheep and the C programm is very lightweight, but it is sort of system specific anyway (at the moment I only have a linux version, which should work under other unices - but probably not under winsocks). At least the java side is of course the same for every platform; this might be the only thing to go into the jboss distribution, so we don't pollute the build system with C. All this is not exactly jboss-specific, but I wondered if other jboss services could use icmp access? Is there a more simple icmp solution around, which works at least under win2k _and_ linux? (I heard there is something planned for jdk 1.5; I'd like to see how sun works around the "root-only" problem under unix...) Regards, Michael ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development