static int quickPortCheck_timeout = 5000; // returns hello message or null static S quickPortCheck(int port) { try { Socket socket = new Socket(); try { socket.setSoTimeout(quickPortCheck_timeout); socket.connect(new InetSocketAddress("localhost", port), quickPortCheck_timeout); //if (verbose) print("Connected to " + ip + ":" + port); BufferedReader in = new BufferedReader( new InputStreamReader(socket.getInputStream(), "UTF-8")); ret or(in.readLine(), "?"); } finally { socket.close(); } } catch (Exception ex) { return null; } }
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: | 435 / 437 |
Referenced in: | [show references] |