1 | static int quickPortCheck_timeout = 5000; |
2 | |
3 | // returns hello message or null |
4 | static S quickPortCheck(int port) { |
5 | try { |
6 | Socket socket = new Socket(); |
7 | try { |
8 | socket.setSoTimeout(quickPortCheck_timeout); |
9 | socket.connect(new InetSocketAddress("localhost", port), quickPortCheck_timeout); |
10 | //if (verbose) print("Connected to " + ip + ":" + port); |
11 | BufferedReader in = new BufferedReader( |
12 | new InputStreamReader(socket.getInputStream(), "UTF-8")); |
13 | ret or(in.readLine(), "?"); |
14 | } finally { |
15 | socket.close(); |
16 | } |
17 | } catch (Exception ex) { |
18 | return null; |
19 | } |
20 | } |
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: | #1005759 |
Snippet name: | quickPortCheck |
Eternal ID of this version: | #1005759/1 |
Text MD5: | 9923e8a40cce3b5cb3485f8a019b11a0 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-07 13:38:36 |
Source code size: | 624 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 436 / 438 |
Referenced in: | [show references] |