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

25
LINES

< > BotCompany Repo | #1001147 // telnetFromConsoleTo

JavaX fragment (include)

static void telnetFromConsoleTo(S host, int port) {
  telnetFromConsoleTo(talkTo(host, port));
}
  
static void telnetFromConsoleTo(final DialogIO io) {
  // output
  thread {
    S line;
    while ((line = readLine()) != null) {
      print("Sending: " + quote(line));
      io.sendLine(line);
    }
  }
  
  // input
  while (io.isStillConnected()) {
    if (io.waitForLine()) {
      S line = io.readLineNoBlock();
      print("> " + line);
    }
  }
  
  print();
  print("[logout]");
}

Author comment

Began life as a copy of #1001077

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001147
Snippet name: telnetFromConsoleTo
Eternal ID of this version: #1001147/1
Text MD5: 86e56fe4b401080b0615f305d544cf72
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-11-10 21:10:35
Source code size: 514 bytes / 25 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 632 / 878
Referenced in: [show references]