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.pswp.cn/news/392473.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/392473.shtml
英文地址,請注明出處:http://en.pswp.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 …