Lid |
|
ik heb deze code het werkt maar het is heeel langzaam weet iemand waarom?
import java.net.Socket;
import java.io.IOException;
import java.io.*;
public class portscan {
public static void main(String[] args) throws IOException {
int i = 0;
String remote = "localhost";
FileWriter fstream = new FileWriter("hello.txt");
BufferedWriter out = new BufferedWriter(fstream);
do {
try {
Socket s = new Socket(remote,i);
out.write("Server is listening on port " + i+ " of " + remote );
out.newLine();
s.close();
} catch (IOException ex) {
out.write("Server is not listening on port " + i+ " of " + remote);
out.newLine();
}
i++;
} while(i <= 55000);
out.close();
}}
import java.net.Socket; import java.io.IOException; import java.io.*; public class portscan { int i = 0; do { try { out.write("Server is listening on port " + i+ " of " + remote ); out.newLine(); s.close(); out.write("Server is not listening on port " + i+ " of " + remote); out.newLine(); } i++; } while(i <= 55000); out.close(); }}
|