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

16
LINES

< > BotCompany Repo | #1001332 // killPortAndWait

JavaX fragment (include)

static void killPortAndWait(int port) {
  killPortAndWait("localhost", port);
}

static void killPortAndWait(S ip, int port) ctex {
  print("Sending kill switch to " + ip + ":" + port);
  DialogIO io = talkTo(ip, port);
  io.sendLine("kill!");
  try {
    // wait until it is closed from other side
    S s;
    while ((s = io.readLine()) != null)
      print(port + "< " + s);
  } catch (Exception e) {}
  io.close(); // never throws exceptions
}

Author comment

Began life as a copy of #1001070

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: #1001332
Snippet name: killPortAndWait
Eternal ID of this version: #1001332/2
Text MD5: f942894578799e6b9336b163c8004945
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-14 11:09:08
Source code size: 462 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 657 / 956
Version history: 1 change(s)
Referenced in: [show references]