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

42
LINES

< > BotCompany Repo | #1016576 // Connect To Server [socket version, Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (6649L/46K).

!7

sclass ConnectToServer extends DynBigNumber {
  transient DialogIO io;
  
  void cleanMeUp {
    if (io != null) io.close();
  }
  
  void start {
    super.start();
    setDescription("COMPUTERS ONLINE");
    connect();
    doEvery(30000, r {
      if (io != null) io.sendLine("");
    });
  }
  
  void connect {
    thread "Connect" {
      while licensed {
        pcall {
          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 *", "computerCount"));
          S line;
          while ((line = io.readLine()) != null) {
            if (nempty(line)) print("Have msg: " + line);
            new Matches m;
            if (swic(line, "ComputerCount = ", m))
              setValue(parseInt($1));
          }
        }
        io = null;
        sleepSeconds(5);
      }
    }
  }
}

Author comment

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: 551 / 79206
Version history: 11 change(s)
Referenced in: [show references]