本文介绍了Java端口扫描程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import java.Socket;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
String remote = "69.163.44.171";
int i = 0;
do {
try {
Socket s = new Socket(remote,i);
System.out.println("Server is listening on port " + i+ " of " + remote);
s.close();
} catch (IOException ex) {
System.out.println("Server is not listening on port " + i+ " of " + remote);
}
i++;
} while(i == 55000);
}
输出:
Server is not listening on port 0 of 69.163.44.171 BUILD SUCCESSFUL (total time: 0 seconds)我使用while循环导致它更快,现在问题为什么它只扫描一个端口?
i use while loop cause it is faster, now to the question why does it only scan one port?
推荐答案嗯...... 你认为条件的频率是多少(i == 55000)将 true ?
Well... how often did you think the condition while(i == 55000) would be true?
更多推荐
Java端口扫描程序
发布评论