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

25
LINES

< > BotCompany Repo | #1001147 // telnetFromConsoleTo

JavaX fragment (include)

1  
static void telnetFromConsoleTo(S host, int port) {
2  
  telnetFromConsoleTo(talkTo(host, port));
3  
}
4  
  
5  
static void telnetFromConsoleTo(final DialogIO io) {
6  
  // output
7  
  thread {
8  
    S line;
9  
    while ((line = readLine()) != null) {
10  
      print("Sending: " + quote(line));
11  
      io.sendLine(line);
12  
    }
13  
  }
14  
  
15  
  // input
16  
  while (io.isStillConnected()) {
17  
    if (io.waitForLine()) {
18  
      S line = io.readLineNoBlock();
19  
      print("> " + line);
20  
    }
21  
  }
22  
  
23  
  print();
24  
  print("[logout]");
25  
}

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: 634 / 880
Referenced in: [show references]