2015-05-05 11:20:13 -07:00
|
|
|
|
//: network/WhoAmI.java
|
2015-05-29 14:18:51 -07:00
|
|
|
|
// <20>2015 MindView LLC: see Copyright.txt
|
2015-05-05 11:20:13 -07:00
|
|
|
|
// Finds out your network address when you're
|
|
|
|
|
// connected to the Internet.
|
|
|
|
|
// {Args:MindviewToshibaLaptop}
|
|
|
|
|
import java.net.*;
|
|
|
|
|
|
|
|
|
|
public class WhoAmI {
|
|
|
|
|
public static void main(String[] args)
|
|
|
|
|
throws Exception {
|
|
|
|
|
if(args.length != 1) {
|
|
|
|
|
System.err.println(
|
|
|
|
|
"Usage: WhoAmI MachineName");
|
|
|
|
|
System.exit(1);
|
|
|
|
|
}
|
|
|
|
|
InetAddress a =
|
|
|
|
|
InetAddress.getByName(args[0]);
|
|
|
|
|
System.out.println(a);
|
|
|
|
|
}
|
|
|
|
|
} ///:~
|