static int isPortOpen_timeout = 500; static boolean isPortOpen(int port) { try { Socket socket = new Socket(); socket.connect(new InetSocketAddress("127.0.0.1", port), isPortOpen_timeout); //print("Connected to " + ip + ":" + port); socket.close(); return true; } catch (Exception ex) { return false; } }
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: | #1000808 |
Snippet name: | isPortOpen |
Eternal ID of this version: | #1000808/1 |
Text MD5: | 66163546e21486a4beb1560b22c425cb |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-28 19:12:42 |
Source code size: | 345 bytes / 12 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 696 / 933 |
Referenced in: | [show references] |