1 | // We're hitting 255 machines in parallel :) |
2 | // Returns list of found aware machines |
3 | |
4 | static bool empBlast_verbose; |
5 | |
6 | static L<S> empBlast() {
|
7 | ret empBlast(f isAware); |
8 | } |
9 | |
10 | static L<S> empBlast(fO checkPeer) {
|
11 | final L<S> l = synchroList(); |
12 | new L<Thread> threads; |
13 | S ip = getMyIP(); |
14 | int i = ip.lastIndexOf('.');
|
15 | if (i < 0) ret l; |
16 | S net = substring(ip, 0, i+1); |
17 | L<S> myIPs = myIPs(); |
18 | print("EMP-BLASTING " + net + "*");
|
19 | for (int n = 1; n <= 255; n++) {
|
20 | fS peer = net + n; |
21 | if (!myIPs.contains(peer)) {
|
22 | S msg = "Peer Scan " + peer; |
23 | threads.add(startThread(msg, r {
|
24 | bool yes = false; |
25 | try {
|
26 | yes = isTrue(callF(checkPeer, peer)); |
27 | if (yes) l.add(peer); |
28 | } finally {
|
29 | if (empBlast_verbose) print(peer + ": " + (yes ? "Yes" : "No (or timeout)")); |
30 | } |
31 | })); |
32 | } |
33 | } |
34 | waitForThreads(threads); |
35 | ret l; |
36 | } |
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: | #1008226 |
| Snippet name: | empBlast - scan subnet for aware machines ^^ |
| Eternal ID of this version: | #1008226/11 |
| Text MD5: | 7ee0bf65c01ca6827111fd594bf89875 |
| Author: | stefan |
| Category: | javax / networking |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-11-05 00:40:49 |
| Source code size: | 928 bytes / 36 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 793 / 831 |
| Version history: | 10 change(s) |
| Referenced in: | [show references] |