Download Jar. Libraryless. Click here for Pure Java version (3896L/27K).
!7 static S ip = "tinybrain.de" /*"127.0.0.1"*/; static int count = 2; static boolean result; p { // Java has trouble executing pings, so we use the native command. S cmd = "ping " + (isWindows() ? "-n" : "-c") + " " + count + " " + ip; S output = backtick(cmd); print(output); L<S> tok = javaTok(output); int i = findCodeTokens(tok, "ttl", "="); if (i < 0) i = findCodeTokens(tok, "TTL", "="); result = i >= 0; print(result ? ip + " is reachable." : ip + " is not reachable."); }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, dhtvkmknsjym, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
1 comment(s) hidden. show
Snippet ID: | #1001197 |
Snippet name: | Native Ping! (should work everywhere) |
Eternal ID of this version: | #1001197/2 |
Text MD5: | fb0d800c090b82c44af1b38c00f27c54 |
Transpilation MD5: | 391f83836cfc55f6f3576a3cf7912a2a |
Author: | stefan |
Category: | javax networking |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-18 12:44:26 |
Source code size: | 526 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 1098 / 1821 |
Version history: | 1 change(s) |
Referenced in: | [show references] |