Hi, I want to write a program that plays a sound when a computer, specified by it's ip address, comes online/is turned on. It would be great if I wouldn't have to write a client for the observed computer. I just want to know if there is someone at the end of the line at 220.127.116.115(just an example and a fake ip address of course). I could use functionality similar to the MS-Dos ping command, but my friend Google already told me that Java doesn't support such a low-level protocol as used for the ping requests. Do you know any solution where the observed computer doesn't have to have something in it's autostart that listens on a port just for such higher-level ping requests? Thanks in advance
Joined: Jan 23, 2002
Even though Java doesn't support ICMP (ping), you can always call "ping" with java.lang.Runtime#exec()
Thanks a lot, that's what I needed. As you can see, I'm quite new to Java. It's a pity that my App loses its platform independence this way, but I don't think there's an option.
Joined: Jul 03, 2001
Hello. What about trying to connect to a port of the host? If the result is "java.net.ConnectException: Connection refused: no further information" that means the computer is reachable though there is no process listening at that port. You might use the connect method that is able to throw a SocketTimeoutException.