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

8
LINES

< > BotCompany Repo | #1004112 // portIsFree - check if port is still free (only works reliably with ports >= 1024)

JavaX fragment (include)

static bool portIsFree(int port) {
  try {
    new ServerSocket(port).close();
    true;
  } catch (IOException e) {
    false;
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004112
Snippet name: portIsFree - check if port is still free (only works reliably with ports >= 1024)
Eternal ID of this version: #1004112/1
Text MD5: c8c43cd25db0490fe01317333f623238
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-07 17:52:15
Source code size: 140 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 553 / 562
Referenced in: [show references]