java udp ip端口 设置_UDP端口扫描Java只找到1个开放的UDP端口

我对端口扫描有一个分歧.我在

Java中扫描一些IP地址的UDP端口.在我的程序中(假设一切正常)我只能找到一个开放的UDP端口.在另一方面端口扫描“nmap”我得到4个开放的UDP端口.有人可以告诉我为什么我不能通过Java代码找到多个端口?

顺便说一句,我可以在我的代码中找到真正的开放端口.

int startPortRange=1;

int stopPortRange=1024;

InetAddress address = InetAddress.getByName("bigblackbox.cs.binghamton.edu");

int counter=0;

for(int i=startPortRange; i <=stopPortRange; i++)

{

counter++;

try{

byte [] bytes = new byte[128];

DatagramSocket ds = new DatagramSocket();

DatagramPacket dp = new DatagramPacket(bytes, bytes.length);

ds.setSoTimeout(100);

ds.connect(address, i);

ds.send(dp);

ds.isConnected();

dp = new DatagramPacket(bytes, bytes.length);

ds.receive(dp);

ds.close();

System.out.println("open");

System.out.println(counter);

}

catch(InterruptedIOException e){

//System.out.println("closed");

}

catch(IOException e){

//System.out.println("closed");

}

}

上面代码的输出是

135开

当我使用nmap在命令行中进行相同的操作时,我获得了更多的开放端口.

我无法上传图片,因为我是新用户.

谢谢

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/392473.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

pandas之Seris和DataFrame

pandas是一个强大的python工具包&#xff0c;提供了大量处理数据的函数和方法&#xff0c;用于处理数据和分析数据。 使用pandas之前需要先安装pandas包&#xff0c;并通过import pandas as pd导入。 一、系列Series Seris为带标签的一维数组&#xff0c;标签即为索引。 1.Seri…

机器学习:分类_机器学习基础:K最近邻居分类

机器学习:分类In the previous stories, I had given an explanation of the program for implementation of various Regression models. Also, I had described the implementation of the Logistic Regression model. In this article, we shall see the algorithm of the K…

leetcode 714. 买卖股票的最佳时机含手续费(dp)

给定一个整数数组 prices&#xff0c;其中第 i 个元素代表了第 i 天的股票价格 &#xff1b;非负整数 fee 代表了交易股票的手续费用。 你可以无限次地完成交易&#xff0c;但是你每笔交易都需要付手续费。如果你已经购买了一个股票&#xff0c;在卖出它之前你就不能再继续购买…

如何在Angular Material中制作自定义主题

by Charlee Li通过李李 如何在Angular Material中制作自定义主题 (How to make a custom theme in Angular Material) Angular Material is a great library that implements Material Design for Angular 2. The official document is sufficient regarding the component us…

最感叹的莫过于一见如故,最悲伤的莫过于再见陌路。最深的孤独,是你明知道自己的渴望,却得对它装聋作哑。最美的你不是生如夏花,而是在时间的长河里,波澜不惊。...

最感叹的莫过于一见如故&#xff0c;最悲伤的莫过于再见陌路。最深的孤独&#xff0c;是你明知道自己的渴望&#xff0c;却得对它装聋作哑。最美的你不是生如夏花&#xff0c;而是在时间的长河里&#xff0c;波澜不惊。转载于:https://www.cnblogs.com/dj258/p/7003890.html

java vimrc_.vimrc技巧

-------------------------------------------------------------------" 设置字符编码。参考&#xff1a;http://www.rainux.org/blog/index.php/2005/10/20/106" encoding: Vim 内部使用的字符编码方式&#xff0c;包括 Vim 的buffer (缓冲区)、菜单文" 本、消…

将PDF和Gutenberg文档格式转换为文本:生产中的自然语言处理

Estimates state that 70%–85% of the world’s data is text (unstructured data). Most of the English and EU business data formats as byte text, MS Word, or Adobe PDF. [1]据估计&#xff0c;全球数据的70&#xff05;–85&#xff05;是文本(非结构化数据)。 大多数…

Go_笔试题记录-指针与值类型实现接口的区别

1、如果Add函数的调用代码为&#xff1a; func main() {var a Integer 1var b Integer 2var i interface{} &asum : i.(*Integer).Add(b)fmt.Println(sum) } 则Add函数定义正确的是&#xff08;&#xff09; A.type Integer int func (a Integer) Add(b Integer) Intege…

leetcode 48. 旋转图像

解题思路 将数组从里到外分为若干层&#xff0c; 数组 [1,2,3], [4,5,6][7,8,9]的最外层即为 [1,2,3] [4 6][7,8,9] &#xff0c;将一层分为4条边&#xff0c;如741 123&#xff0c;将741放到123的位置&#xff0c;123放到369的位置&#xff0c;如此类推&#xff08;但是放置的…

如何恢复误删的OneNote页面

今天不小心把半个月的日记删掉了&#xff01;&#xff08;为了减少页面数量&#xff0c;每个月的日记会放在同一个页面上&#xff09;。 幸运的是OneNote有自动备份功能&#xff0c;喜极而泣。 操作方法来自微软支持 打开丢失了最近笔记的笔记本。 单击“文件”>“信息”&g…

javascript函数式_JavaScript中的函数式编程原理

javascript函数式After a long time learning and working with object-oriented programming, I took a step back to think about system complexity.经过长时间的学习和使用面向对象的编程&#xff0c;我退后了一步来思考系统的复杂性。 “Complexity is anything that mak…

java writeint_Java DataOutputStream.writeInt(int v)类型

DataOutputStream.writeInt(int v)方法示例DataOutputStream的DataOutputStream.writeInt(int v)方法具有以下语法。public final void writeInt(int v) throws IOException示例在下面的代码中展示了如何使用DataOutputStream.writeInt(int v)方法。import java.io.DataInputSt…

协方差意味着什么_“零”到底意味着什么?

协方差意味着什么When I was an undergraduate student studying Data Science, one of my professors always asked the same question for every data set we worked with — “What does zero mean?”当我是一名研究数据科学的本科生时&#xff0c;我的一位教授总是对我们处…

Go_笔试题记录-不熟悉的

1、golang中没有隐藏的this指针&#xff0c;这句话的含义是&#xff08;&#xff09; A. 方法施加的对象显式传递&#xff0c;没有被隐藏起来 B. golang沿袭了传统面向对象编程中的诸多概念&#xff0c;比如继承、虚函数和构造函数 C. golang的面向对象表达更直观&#xff0c;对…

leetcode 316. 去除重复字母(单调栈)

给你一个字符串 s &#xff0c;请你去除字符串中重复的字母&#xff0c;使得每个字母只出现一次。需保证 返回结果的字典序最小&#xff08;要求不能打乱其他字符的相对位置&#xff09;。 注意&#xff1a;该题与 1081 https://leetcode-cn.com/problems/smallest-subsequenc…

Go-json解码到结构体

废话不多说&#xff0c;直接干就得了&#xff0c;上代码 package mainimport ("encoding/json""fmt" )type IT struct {Company string json:"company" Subjects []string json:"subjects"IsOk bool json:"isok"…

leetcode 746. 使用最小花费爬楼梯(dp)

数组的每个索引作为一个阶梯&#xff0c;第 i个阶梯对应着一个非负数的体力花费值 costi。 每当你爬上一个阶梯你都要花费对应的体力花费值&#xff0c;然后你可以选择继续爬一个阶梯或者爬两个阶梯。 您需要找到达到楼层顶部的最低花费。在开始时&#xff0c;你可以选择从索…

安卓中经常使用控件遇到问题解决方法(持续更新和发现篇幅)(在textview上加一条线、待续)...

TextView设置最多显示30个字符。超过部分显示...(省略号)&#xff0c;有人说分别设置TextView的android:signature"true",而且设置android:ellipsize"end";可是我试了。居然成功了&#xff0c;供大家參考 [java] view plaincopy<TextView android:id…

网络工程师晋升_晋升为工程师的最快方法

网络工程师晋升by Sihui Huang黄思慧 晋升为工程师的最快方法 (The Fastest Way to Get Promoted as an Engineer) We all want to live up to our potential, grow in our career, and do the best work of our lives. Getting promoted at work not only proves that we hav…

java 银行存取款_用Java编写银行存钱取钱

const readline require(‘readline-sync‘)//引用readline-synclet s 2;//错误的次数for (let i 0; i < 3; i) {console.log(‘请输入名&#xff1a;(由英文组成)‘);let user readline.question();console.log(‘请输入密码&#xff1a;(由数字组成)‘);let password …