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

30
LINES

< > BotCompany Repo | #1027047 - OS Instances Connector [on port 6000 by default]

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

Libraryless. Click here for Pure Java version (16224L/119K).

!7

sclass OIC > DynPrintLogAndEnabled {
  switchable int port = 6000;
  switchable bool verbose;
  transient OSInstancesConnector connector;
  
  start-thread {
    if (!enabled) ret;
    connector = OSInstancesConnector(port);
    connector.onLineReceived.add(voidfunc(S line, O socket, O state) enter {
      if (verbose)
        print("Line received: " + shorten(50, line));
    });
    connector.start();
    print("Connector on port " + port + " listening");
    print("IPs: " + myIPs());
    dm_registerAs_direct instancesConnector();
  }
  
  void cleanMeUp {
    dispose connector;
  }
  
  // API
  
  void sendToChannel(S channel, S line) {
    connector.getChannel(channel).handleLine(line, null);
  }
}

download  show line numbers  debug dex   

Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027047
Snippet name: OS Instances Connector [on port 6000 by default]
Eternal ID of this version: #1027047/10
Text MD5: 05d90b75633d37819bbe78b55b982ba3
Transpilation MD5: c07335874df6428e9cf77e436945e324
Author: stefan
Category: javax / networking
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-15 15:20:36
Source code size: 744 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 61 / 4549
Version history: 9 change(s)
Referenced in: #1027066

Formerly at http://tinybrain.de/1027047 & http://1027047.tinybrain.de