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
ID | Author/Program | Comment | Date |
---|---|---|---|
1108 | stefan | Works on Linux + Windows. Android to test | 2015-09-29 19:56:34 |
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: | 1097 / 1820 |
Version history: | 1 change(s) |
Referenced in: | #1002698 - Native Ping with getting IP and time (tested on Linux and Windows) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |