1 | static int isPortOpen_timeout = 500; |
2 | static boolean isPortOpen(int port) { |
3 | try { |
4 | Socket socket = new Socket(); |
5 | socket.connect(new InetSocketAddress("127.0.0.1", port), isPortOpen_timeout); |
6 | //print("Connected to " + ip + ":" + port); |
7 | socket.close(); |
8 | return true; |
9 | } catch (Exception ex) { |
10 | return false; |
11 | } |
12 | } |
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: | 698 / 936 |
Referenced in: | [show references] |