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)

1  
static bool portIsFree(int port) {
2  
  try {
3  
    new ServerSocket(port).close();
4  
    true;
5  
  } catch (IOException e) {
6  
    false;
7  
  }
8  
}

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