Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #1007894 // hostToIP - fails if no address found

JavaX fragment (include)

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: 493 / 493
Version history: 6 change(s)
Referenced in: [show references]