static S hostToIP(S host) ctex { for (InetAddress a : InetAddress.getAllByName(host)) { S ip = a.getHostAddress(); if (isIPv4(ip)) ret ip; // yep we're still on v4 } fail("No IP address found for " + host); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007894 |
| Snippet name: | hostToIP - fails if no address found |
| Eternal ID of this version: | #1007894/7 |
| Text MD5: | 994a1f17b434d66d021df2cf7cf41b70 |
| Author: | stefan |
| Category: | javax / networking |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-04-15 15:13:05 |
| Source code size: | 228 bytes / 7 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 815 / 816 |
| Version history: | 6 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1007895 - hostToIPOpt - returns null if no address found #1007896 - ipToHost - reverse DNS lookup; also takes a host name |