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).

!7

static int timeout = 10000;

p {
  while licensed {
    long time = now();
    bool ok = pingServer();
    time = now()-time;
    print("Ping to tinybrain.de OK: " + ok + ", time: " + time + " ms");
    setConsoleTitle((ok ? time + " ms" : "NO PING") + " - tinybrain.de");
    sleepSeconds(1);
  }
}

sbool pingServer() {
  try {
    ret isInteger(trim(loadPageSilentlyWithTimeout("http://tinybrain.de:8080/tb/all-computers.php?justthenumber=1", timeout)));
  } catch e {
    print(exceptionToStringShort(e));
    ret false;
  }
}

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