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

23
LINES

< > BotCompany Repo | #1005737 // Repeatedly show ping time to tinybrain.de (using http)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (4275L/28K/95K).

1  
!7
2  
3  
static int timeout = 10000;
4  
5  
p {
6  
  while licensed {
7  
    long time = now();
8  
    bool ok = pingServer();
9  
    time = now()-time;
10  
    print("Ping to tinybrain.de OK: " + ok + ", time: " + time + " ms");
11  
    setConsoleTitle((ok ? time + " ms" : "NO PING") + " - tinybrain.de");
12  
    sleepSeconds(1);
13  
  }
14  
}
15  
16  
sbool pingServer() {
17  
  try {
18  
    ret isInteger(trim(loadPageSilentlyWithTimeout("http://tinybrain.de:8080/tb/all-computers.php?justthenumber=1", timeout)));
19  
  } catch e {
20  
    print(exceptionToStringShort(e));
21  
    ret false;
22  
  }
23  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005737
Snippet name: Repeatedly show ping time to tinybrain.de (using http)
Eternal ID of this version: #1005737/5
Text MD5: 7fcef61d50aea45ea572606aba24107e
Transpilation MD5: a65750d74535297b5092bca83e31dfe3
Author: stefan
Category: javax / networking
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-22 04:52:45
Source code size: 556 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 542 / 636
Version history: 4 change(s)
Referenced in: [show references]