Libraryless. Click here for Pure Java version (6649L/46K).
1 | !7 |
2 | |
3 | sclass ConnectToServer extends DynBigNumber { |
4 | transient DialogIO io; |
5 | |
6 | void cleanMeUp { |
7 | if (io != null) io.close(); |
8 | } |
9 | |
10 | void start { |
11 | super.start(); |
12 | setDescription("COMPUTERS ONLINE"); |
13 | connect(); |
14 | doEvery(30000, r { |
15 | if (io != null) io.sendLine(""); |
16 | }); |
17 | } |
18 | |
19 | void connect { |
20 | thread "Connect" { |
21 | while licensed { |
22 | pcall { |
23 | io = talkTo("smartbot.botcompany.de", 6000); |
24 | io.getSocket().setSoTimeout(30000+10000); |
25 | print("Connected."); |
26 | temp tempAfterwards(r { print("Disconnected.") }); |
27 | io.sendLine(format("computerID=*", computerID())); |
28 | io.sendLine(format("sub *", "computerCount")); |
29 | S line; |
30 | while ((line = io.readLine()) != null) { |
31 | if (nempty(line)) print("Have msg: " + line); |
32 | new Matches m; |
33 | if (swic(line, "ComputerCount = ", m)) |
34 | setValue(parseInt($1)); |
35 | } |
36 | } |
37 | io = null; |
38 | sleepSeconds(5); |
39 | } |
40 | } |
41 | } |
42 | } |
Began life as a copy of #1016455
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, hpgrupgrauku, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016576 |
Snippet name: | Connect To Server [socket version, Dyn Module] |
Eternal ID of this version: | #1016576/12 |
Text MD5: | 3fa611dab45f301399fc8eacf6ad9b83 |
Transpilation MD5: | a1af4d14d756f311c260642aca513001 |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-08-04 18:29:37 |
Source code size: | 1067 bytes / 42 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 553 / 79210 |
Version history: | 11 change(s) |
Referenced in: | [show references] |