C # Implement a network segment scan

xiaoxiao2021-03-06  135

Class: DNS class: Under the system.net namespace in .NET, the main function is to retrieve information about a particular host from the Internet Domain Name System (DNS). IPHOSTENTRY Class: Associate a Domain Name System (DNS) host with a group of aliases and a set of matching IP addresses, and uses with the DNS class. IPaddress class: address on IP network. The namespace used is: system.net Namespace provides a simple programming interface for multiple protocols used by the current network. System.io namespace contains synchronous and asynchronous reading and writing on data streams and files Types of. System.Thread namespace is mainly used to program multiple-line programs. The program implements the following features: 2. Get the local host IP address // Response for the Event of the Button Control Private Void Buttion1_Click (Object Sender, System.Event.Args E) {iphostentry myhost = new ipHostentry (); try {// DNS.GETOSTNAME () Gets hostname // dns.getHostByname () gets the DNS information of the specified DNS host name // to get the DNS information of the local host MYHOST = DNS.GETHOSTBYNAME (DNS.GETHOSTNAME ()); // Display Local host name TextBox1.text = myhost.hostname.tostring (); // Displays the IP address table for local host (int i = 0; i " myhost.addresslist [i] .tostring () " / r ");} catch (exception error) {messagebox.show (error.Message);}} // private

3. Remote Query Private Void Buttion2_Click (Object Sender, System.EventArgs E) {

Iphostentry mydnstoip = new iphostentry (); //dns.resolve method: parsing the DNS hostname or separated four-part indication format // IP address to iPhostentry instance mydnstoip = dns.resolve (TextBox2.Text.toString (TEXTBOX2.TEXT.TOSTRING )); // shows the list for the IP address of this domain name for (INT i = 0; I

转载请注明原文地址:https://www.9cbs.com/read-127354.html

New Post(0)