c 獲得區域網主機列表例項

2021-03-31 08:57:00 字數 2316 閱讀 8419

/// 陣列初始化

///

private void initlanhost()

}///

/// 清理所有正在使用的資源。

///

protected override void dispose( bool disposing )

}base.dispose( disposing );

}#region windows 窗體設計器生成的**

///

/// 設計器支援所需的方法 - 不要使用**編輯器修改

/// 此方法的內容。

///

private void initialize***ponent()

);this.listview1.location = new system.drawing.point(248, 40);

this.listview1.name = "listview1";

this.listview1.size = new system.drawing.size(184, 288);

this.listview1.tabindex = 5;

// // columnheader1

// this.columnheader1.text = "dddd";

// // columnheader2

// this.columnheader2.text = "sssss";

// // form1

// this.autoscalebasesize = new system.drawing.size(6, 14);

this.clientsize = new system.drawing.size(544, 413);

this.controls.add(this.listview1);

this.controls.add(this.progressbarsearch);

this.controls.add(this.button1);

this.controls.add(this.textbox1);

this.name = "form1";

this.text = "form1";

this.resumelayout(false);

}#endregion

///

/// 應用程式的主入口點。

///

private void lansearch()

}getlanhost();

listlanhost();

}///

/// 多執行緒搜尋方法

///

private void lansearchthreadmethod()

//progressbarsearch.value = progressbarsearch.value +1;

}///

/// 文字框顯示主機名與ip列表

///

private void getlanhost()

}///

/// listview1 顯示搜尋主機

///

private void listlanhost()}}

///

/// 進度條處理執行緒

///

private void progresssearch()}}

}遺憾之處:因搜尋較慢,沒有實現真實的搜尋進度。

不懂之處:實現文字提示時,當在滑鼠事件首尾插入

private void button1_click(object sender, system.eventargs e)

文字提示時,在lab1上始終不能及時顯示,而是等所有執行緒結束後才顯示「結束搜尋「。

初學winform程式設計,太多的要學了。

望高手指點一二

快速掃描區域網主機的方式

第一 目前瞭解最多的就是ping實現,然後各種去ping包,這種有一個問題,如果主機關了ping這個選項,就比較麻煩!就是 echo 1 proc sys net ipv4 icmp echo ignore broadcasts 來關閉該功能,從而防止icmp風暴,防止網路阻塞。第二 據我所知,目前...

攔截SendArp偽造對應區域網主機MAC地址

int tmain int argc,tchar ar if dwretval getipaddrtable pipaddrtable,dwsize,0 no error else printf over free pipaddrtable getch hook 方式 攔截 deviceiocont...

cmd 獲得區域網基本資訊

在桌面右鍵,新建txt檔案,輸入一下內容,並更改檔名為 pcinfo.bat 關閉echo echo off 設定延遲變數 setlocal enabledelayedexpansion 設定視窗標題 title my pc info time 設定視窗前景色背景色 f 白 2 綠 color f2...

C 查詢區域網內所有電腦

本文主要示例winform中的非同步呼叫,至於活動目錄等相關知識,還需另查資料.要完成本例的除錯,需在一個窗體上加一個richtextbox1和一button1.點button1時會在richtextbox1中顯示所有域名及其下的各計算機名稱和ip地址.一臺電計算機顯示一行,如果有多個ip也顯示在同...

C 區域網內socket通訊 TCP

判斷對方正常斷開連線的方法 這裡的正常斷開是指呼叫socket.shutdown socket.close 關閉socket的方法。此時,另一方的socket.receive 方法會返回0個位元組,即bytes socket.receive 的bytes 0 具體的寫法參照msdn,如下連線。判斷對...