Skip to content

Commit f12a8bf

Browse files
committed
add ip() method to Server (issue 1228)
1 parent ce99e30 commit f12a8bf

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

java/libraries/net/src/processing/net/Server.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,19 @@ protected int clientIndex(Client client) {
147147
return -1;
148148
}
149149

150+
151+
static public String ip() {
152+
try {
153+
return InetAddress.getLocalHost().getHostAddress();
154+
} catch (UnknownHostException e) {
155+
e.printStackTrace();
156+
}
157+
return null;
158+
// InetAddress thisIp = InetAddress.getLocalHost();
159+
// thisIpAddress = thisIp.getHostAddress()
160+
// return server.getInetAddress().getHostAddress();
161+
}
162+
150163

151164
// the last index used for available. can't just cycle through
152165
// the clients in order from 0 each time, because if client 0 won't

0 commit comments

Comments
 (0)