1 | static L<S> getMyIPs() ctex {
|
2 | new TreeSet<S> ips; |
3 | Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); |
4 | while (interfaces.hasMoreElements()) {
|
5 | NetworkInterface iface = interfaces.nextElement(); |
6 | // filters out 127.0.0.1 and inactive interfaces |
7 | if (iface.isLoopback() || !iface.isUp()) |
8 | continue; |
9 | |
10 | Enumeration<InetAddress> addresses = iface.getInetAddresses(); |
11 | while(addresses.hasMoreElements()) {
|
12 | InetAddress addr = addresses.nextElement(); |
13 | S ip = addr.getHostAddress(); |
14 | if (ip.startsWith("127.")) continue;
|
15 | ips.add(ip); |
16 | } |
17 | } |
18 | return new ArrayList<S>(ips); |
19 | } |
Began life as a copy of #1000841
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001181 |
| Snippet name: | getMyIPs |
| Eternal ID of this version: | #1001181/1 |
| Text MD5: | d8c816d9af0b3760cc54a39b238829dc |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-09-28 18:23:45 |
| Source code size: | 668 bytes / 19 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 992 / 1303 |
| Referenced in: | [show references] |