Libraryless. Click here for Pure Java version (8187L/55K).
!7 sclass AllOnlineComputers extends DynCalculatedList { LS computerIDs, data; transient DialogIO io; L<S> calc() { ret data; } void cleanMeUp { if (io != null) io.close(); } start { connect(); doEvery(30000, r { if (io != null) io.sendLine("") }); } void connect { thread "Connect" { while licensed { try { io = talkTo("smartbot.botcompany.de", 6000); io.getSocket().setSoTimeout(30000+10000); print("Connected."); temp tempAfterwards(r { print("Disconnected.") }); io.sendLine(format("computerID=*", computerID())); io.sendLine(format("sub *", "computerIDs")); print("Sent computer ID: " + computerID()); S line; while ((line = io.readLine()) != null) { if (nempty(line)) print("Have msg: " + line); new Matches m; if (swic(line, "ComputerIDs = ", m)) { computerIDs = safeUnstruct($1); fO computerNames = dm_computerNames_opt(); setField(data := sortedIC(map(computerIDs, func(S id) -> S { S name = dm_callOpt(computerNames, 'nameForID, id); ret (eq(id, computerID()) ? "[this one] " : "") + (nempty(name) ? name + " (" + id + ")" : id); }))); vmBus_send('onlineComputerIDs, computerIDs); setModuleName(n2(computerIDs, "Online Computer")); } } } catch e { // pcall would also do an annoying message box printShortException(e); } io = null; sleepSeconds(5); } } } // API LS onlineComputerIDs() { ret computerIDs; } }
Began life as a copy of #1016578
download show line numbers debug dex old transpilations
Travelled to 10 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019753 |
Snippet name: | All Online Computers [Show Connected Computers, old version] |
Eternal ID of this version: | #1019753/1 |
Text MD5: | 7d060cd54c35f7c037e2dda6426d2134 |
Transpilation MD5: | a2df493aec78a241f7d5526ef69e8679 |
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-11-24 18:19:57 |
Source code size: | 1778 bytes / 57 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 345 / 492 |
Referenced in: | -