Java端口扫描程序

编程入门 行业动态 更新时间:2024-10-26 23:37:06
本文介绍了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端口扫描程序

本文发布于:2023-08-07 06:44:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1317564.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   端口扫描   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!