add ip() method to Server (issue 1228)

This commit is contained in:
benfry
2012-11-24 18:43:41 +00:00
parent 728a45dae5
commit 772597e99b
@@ -147,6 +147,19 @@ public class Server implements Runnable {
return -1;
}
static public String ip() {
try {
return InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return null;
// InetAddress thisIp = InetAddress.getLocalHost();
// thisIpAddress = thisIp.getHostAddress()
// return server.getInetAddress().getHostAddress();
}
// the last index used for available. can't just cycle through
// the clients in order from 0 each time, because if client 0 won't