// We're hitting 255 machines in parallel :) // Returns list of found aware machines static bool empBlast_verbose; static L<S> empBlast() { ret empBlast(f isAware); } static L<S> empBlast(fO checkPeer) { final L<S> l = synchroList(); new L<Thread> threads; S ip = getMyIP(); int i = ip.lastIndexOf('.'); if (i < 0) ret l; S net = substring(ip, 0, i+1); L<S> myIPs = myIPs(); print("EMP-BLASTING " + net + "*"); for (int n = 1; n <= 255; n++) { fS peer = net + n; if (!myIPs.contains(peer)) { S msg = "Peer Scan " + peer; threads.add(startThread(msg, r { bool yes = false; try { yes = isTrue(callF(checkPeer, peer)); if (yes) l.add(peer); } finally { if (empBlast_verbose) print(peer + ": " + (yes ? "Yes" : "No (or timeout)")); } })); } } waitForThreads(threads); ret l; }
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: | 558 / 589 |
Version history: | 10 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1011745 - empBlast_port - scan subnet for an open port |