欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#實(shí)現(xiàn)掃描局域網(wǎng)內(nèi)的所有IP和端口

 更新時間:2022年12月28日 08:44:28   作者:芝麻粒兒  
這篇文章主要為大家詳細(xì)介紹了如何利用C#實(shí)現(xiàn)掃描局域網(wǎng)內(nèi)的所有IP和端口的功能,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起了解一下

實(shí)踐過程

效果

代碼

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    #region 實(shí)例化類對象及公共變量
    private Thread myThread;
    string StartIPAddress = "";
    string EndIPAddress = "";
    int intStrat =0;                          //開始掃描地址
    int intEnd = 0;                           //終止掃描地址
    string strIP = "";
    string strflag = "";                      //掃描到的IP地址
    #endregion

    private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            if (button1.Text == "開始")
            { 
                listView1.Items.Clear();            //清空ListView控件中的項(xiàng)
                textBox1.Enabled = textBox2.Enabled = false;
                strIP = "";
                strflag = textBox1.Text;
                StartIPAddress = textBox1.Text;
                EndIPAddress = textBox2.Text;
                //開始掃描地址
                intStrat = Int32.Parse(StartIPAddress.Substring(StartIPAddress.LastIndexOf(".") + 1));
                //終止掃描地址
                intEnd = Int32.Parse(EndIPAddress.Substring(EndIPAddress.LastIndexOf(".") + 1));
                //指定進(jìn)度條最大值
                progressBar1.Minimum = intStrat;
                //指定進(jìn)度條最小值
                progressBar1.Maximum = intEnd;
                //指定進(jìn)度條初始值
                progressBar1.Value = progressBar1.Minimum;
                timer1.Start();             //開始運(yùn)行計(jì)時器
                button1.Text = "停止";      //設(shè)置按鈕文本為停止
                //使用自定義方法StartScan實(shí)例化線程對象
                myThread = new Thread(new ThreadStart(this.StartScan));
                myThread.Start();                           //開始運(yùn)行掃描IP的線程
            }
            else
            {
                textBox1.Enabled = textBox2.Enabled = true;
                button1.Text = "開始";      //設(shè)置按鈕文本為開始
                timer1.Stop();              //停止運(yùn)行計(jì)時器
                //設(shè)置進(jìn)度條的值為最大值
                progressBar1.Value = intEnd;
                if (myThread != null)       //判斷線程對象是否為空
                {
                    //判斷掃描IP地址的線程是否正在運(yùn)行
                    if (myThread.ThreadState == ThreadState.Running)
                    {
                        myThread.Abort();   //終止線程
                    }
                }
            }
        }
        catch { }
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        if (strIP != "")                           //判讀是否有可用IP地址
        {
            if (strIP.IndexOf(',') == -1)
            {
                if (listView1.Items.Count > 0)
                {
                    for (int i = 0; i < listView1.Items.Count; i++)
                    {
                        //判斷掃描到的IP地址是否與列表中的重復(fù)
                        if (listView1.Items[i].Text != strIP)
                        {
                            //向列表中添加掃描到的已用IP地址
                            listView1.Items.Add(strIP);
                        }
                    }
                }
                else
                    //向列表匯總添加掃描到的已用IP地址
                    listView1.Items.Add(strIP);
            }
            else
            {
                string[] strIPS = strIP.Split(',');
                for (int i = 0; i < strIPS.Length; i++)
                {
                    listView1.Items.Add(strIPS[i].ToString());
                }
            }
            strIP = "";
        }
        for (int i = 0; i < listView1.Items.Count; i++)
            listView1.Items[i].ImageIndex = 0;
        if (progressBar1.Value < progressBar1.Maximum)  //判斷進(jìn)度條的當(dāng)前值是否超出其最大值
            progressBar1.Value = Int32.Parse(strflag.Substring(strflag.LastIndexOf(".") + 1));                    //將進(jìn)度條的值加1
        if (strflag == textBox2.Text)  //判斷正在掃描的IP地址是否是結(jié)束IP地址
        {
            timer1.Stop();                              //停止運(yùn)行計(jì)時器
            textBox1.Enabled = textBox2.Enabled = true;
            button1.Text = "開始";                      //設(shè)置按鈕文本為掃描
            MessageBox.Show("IP地址掃描結(jié)束!");
        }
    }

    private void Form1_FormClosed(object sender, FormClosedEventArgs e)
    {
        if (myThread != null)               //判斷線程對象是否為空
        {
            //判斷掃描IP地址的線程是否正在運(yùn)行
            if (myThread.ThreadState == ThreadState.Running)
            {
                myThread.Abort();           //終止線程
            }
        }
    }

    #region 掃描局域網(wǎng)IP地址
    /// <summary>
    /// 掃描局域網(wǎng)IP地址
    /// </summary>
    private void StartScan()
    {
        //掃描的操作
        for (int i = intStrat; i <= intEnd; i++)
        {
            string strScanIP = StartIPAddress.Substring(0, StartIPAddress.LastIndexOf(".") + 1) + i.ToString();
            //轉(zhuǎn)換成IP地址
            IPAddress myScanIP = IPAddress.Parse(strScanIP);
            strflag = strScanIP;
            try
            {
                //址獲取DNS主機(jī)信息
                IPHostEntry myScanHost = Dns.GetHostByAddress(myScanIP);
                //獲取主機(jī)名
                string strHostName = myScanHost.HostName.ToString();
                if (strIP == "")
                    strIP += strScanIP + "->" + strHostName;
                else
                    strIP += "," + strScanIP + "->" + strHostName;
            }
            catch { }
        }
    }
    #endregion
}
partial class Form1
{
    /// <summary>
    /// 必需的設(shè)計(jì)器變量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的資源。
    /// </summary>
    /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗體設(shè)計(jì)器生成的代碼

    /// <summary>
    /// 設(shè)計(jì)器支持所需的方法 - 不要
    /// 使用代碼編輯器修改此方法的內(nèi)容。
    /// </summary>
    private void InitializeComponent()
    {
        this.components = new System.ComponentModel.Container();
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.label1 = new System.Windows.Forms.Label();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.textBox2 = new System.Windows.Forms.TextBox();
        this.label2 = new System.Windows.Forms.Label();
        this.button1 = new System.Windows.Forms.Button();
        this.progressBar1 = new System.Windows.Forms.ProgressBar();
        this.timer1 = new System.Windows.Forms.Timer(this.components);
        this.imageList1 = new System.Windows.Forms.ImageList(this.components);
        this.listView1 = new System.Windows.Forms.ListView();
        this.groupBox1.SuspendLayout();
        this.SuspendLayout();
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.button1);
        this.groupBox1.Controls.Add(this.textBox2);
        this.groupBox1.Controls.Add(this.label2);
        this.groupBox1.Controls.Add(this.textBox1);
        this.groupBox1.Controls.Add(this.label1);
        this.groupBox1.Location = new System.Drawing.Point(4, -1);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(247, 73);
        this.groupBox1.TabIndex = 0;
        this.groupBox1.TabStop = false;
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(9, 21);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(65, 12);
        this.label1.TabIndex = 0;
        this.label1.Text = "開始地址:";
        // 
        // textBox1
        // 
        this.textBox1.Location = new System.Drawing.Point(71, 18);
        this.textBox1.Name = "textBox1";
        this.textBox1.Size = new System.Drawing.Size(112, 21);
        this.textBox1.TabIndex = 1;
        this.textBox1.Text = "192.168.1.1";
        // 
        // textBox2
        // 
        this.textBox2.Location = new System.Drawing.Point(71, 45);
        this.textBox2.Name = "textBox2";
        this.textBox2.Size = new System.Drawing.Size(112, 21);
        this.textBox2.TabIndex = 3;
        this.textBox2.Text = "192.168.1.255";
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(9, 48);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(65, 12);
        this.label2.TabIndex = 2;
        this.label2.Text = "結(jié)束地址:";
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(189, 20);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(50, 44);
        this.button1.TabIndex = 4;
        this.button1.Text = "開始";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // progressBar1
        // 
        this.progressBar1.Location = new System.Drawing.Point(4, 276);
        this.progressBar1.Name = "progressBar1";
        this.progressBar1.Size = new System.Drawing.Size(247, 15);
        this.progressBar1.TabIndex = 2;
        // 
        // timer1
        // 
        this.timer1.Interval = 1000;
        this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
        // 
        // imageList1
        // 
        this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
        this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
        this.imageList1.Images.SetKeyName(0, "ip.ico");
        // 
        // listView1
        // 
        this.listView1.FullRowSelect = true;
        this.listView1.LargeImageList = this.imageList1;
        this.listView1.Location = new System.Drawing.Point(4, 78);
        this.listView1.Name = "listView1";
        this.listView1.Size = new System.Drawing.Size(247, 192);
        this.listView1.SmallImageList = this.imageList1;
        this.listView1.StateImageList = this.imageList1;
        this.listView1.TabIndex = 3;
        this.listView1.UseCompatibleStateImageBehavior = false;
        this.listView1.View = System.Windows.Forms.View.List;
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(256, 293);
        this.Controls.Add(this.listView1);
        this.Controls.Add(this.progressBar1);
        this.Controls.Add(this.groupBox1);
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "局域網(wǎng)IP地址掃描";
        this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.ProgressBar progressBar1;
    private System.Windows.Forms.Timer timer1;
    private System.Windows.Forms.ImageList imageList1;
    private System.Windows.Forms.ListView listView1;
}
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    #region 實(shí)例化類對象和公共變量
    //實(shí)例化DirectoryEntry對象,以便獲得局域網(wǎng)組名和計(jì)算機(jī)名
    DirectoryEntry DEMain = new DirectoryEntry("WinNT:");
    TcpClient TClient = null;       //實(shí)例化連接偵聽對象
    private Thread myThread;        //實(shí)例化線程對象
    string strName = "";            //記錄選擇的計(jì)算機(jī)名稱
    int intflag = 0;                //掃描到的端口號
    int intport = 0;                //記錄已用端口號
    int intstart = 0;               //掃描的開始端口號
    int intend = 0;                 //掃描的結(jié)束端口號
    #endregion

    private void Form1_Load(object sender, EventArgs e)
    {
        //遍歷局域網(wǎng)中的工作組,并顯示在下拉列表控件中
        foreach (DirectoryEntry DEGroup in DEMain.Children)
        {
            comboBox1.Items.Add(DEGroup.Name);
        }
    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        listBox1.Items.Clear();
        foreach (DirectoryEntry DEGroup in DEMain.Children)
        {
            //判斷工作組名稱
            if (DEGroup.Name.ToLower() == comboBox1.Text.ToLower())
            {
                //遍歷指定工作組中的所有計(jì)算機(jī)名稱,并顯示在ListBox控件中
                foreach (DirectoryEntry DEComputer in DEGroup.Children)
                {
                    if (DEComputer.Name.ToLower() != "schema")
                    {
                        listBox1.Items.Add(DEComputer.Name);
                    }
                }
            }
        }
    }

    private void button1_Click(object sender, EventArgs e)
    {
        listView1.Items.Clear();            //清空ListView控件中的項(xiàng)
        try
        {
            if (button1.Text == "掃描")
            {
                intport = 0;                //初始化已用端口號
                //指定進(jìn)度條最大值
                progressBar1.Minimum = Convert.ToInt32(textBox1.Text);
                //指定進(jìn)度條最小值
                progressBar1.Maximum = Convert.ToInt32(textBox2.Text);
                //指定進(jìn)度條初始值
                progressBar1.Value = progressBar1.Minimum;
                timer1.Start();             //開始運(yùn)行計(jì)時器
                button1.Text = "停止";      //設(shè)置按鈕文本為停止
                intstart = Convert.ToInt32(textBox1.Text);  //為開始掃描的端口號賦值
                intend = Convert.ToInt32(textBox2.Text);    //為結(jié)束掃描的端口號賦值
                //使用自定義方法StartScan實(shí)例化線程對象
                myThread = new Thread(new ThreadStart(this.StartScan));
                myThread.Start();                           //開始運(yùn)行掃描端口號的線程
            }
            else
            {
                button1.Text = "掃描";      //設(shè)置按鈕文本為掃描
                timer1.Stop();              //停止運(yùn)行計(jì)時器
                //設(shè)置進(jìn)度條的值為最大值
                progressBar1.Value = Convert.ToInt32(textBox2.Text);
                if (myThread != null)       //判斷線程對象是否為空
                {
                    //判斷掃描端口號的線程是否正在運(yùn)行
                    if (myThread.ThreadState == ThreadState.Running)
                    {
                        myThread.Abort();   //終止線程
                    }
                }
            }
        }
        catch { }
    }

    private void Form1_FormClosed(object sender, FormClosedEventArgs e)
    {
        if (myThread != null)               //判斷線程對象是否為空
        {
            //判斷掃描端口號的線程是否正在運(yùn)行
            if (myThread.ThreadState == ThreadState.Running)
            {
                myThread.Abort();           //終止線程
            }
        }
    }

    private void listBox1_Click(object sender, EventArgs e)
    {
        strName = listBox1.SelectedItem.ToString(); //記錄選擇的計(jì)算機(jī)名稱
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        if (intport != 0)                           //判讀是否有可用端口號
        {
            if (listView1.Items.Count > 0)
            {
                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    //判斷掃描到的端口號是否與列表中的重復(fù)
                    if (listView1.Items[i].Text != intport.ToString())
                    {
                        //向列表中添加掃描到的已用端口號
                        listView1.Items.Add(intport.ToString());
                    }
                }
            }
            else
                //向列表匯總添加掃描到的已用端口號
                listView1.Items.Add(intport.ToString());
            intport = 0;
        }
        if (progressBar1.Value < progressBar1.Maximum)  //判斷進(jìn)度條的當(dāng)前值是否超出其最大值
            progressBar1.Value += 1;                    //將進(jìn)度條的值加1
        if (intflag == Convert.ToInt32(textBox2.Text))  //判斷正在掃描的端口號是否是結(jié)束端口號
        {
            timer1.Stop();                              //停止運(yùn)行計(jì)時器
            button1.Text = "掃描";                      //設(shè)置按鈕文本為掃描
            MessageBox.Show("端口掃描結(jié)束!");
        }
    }

    #region 掃描端口號
    /// <summary>
    /// 掃描端口號
    /// </summary>
    private void StartScan()
    {
        while (true)
        {
            for (int i = intstart; i <= intend; i++)
            {
                intflag = i;                            //記錄正在掃描的端口號
                try
                {
                    TClient = new TcpClient(strName, i);//使用記錄的計(jì)算機(jī)名稱和端口號實(shí)例化偵聽對象
                    intport = i;                        //記錄已分配的端口號
                }
                catch { }
            }
        }
    }
    #endregion
}
partial class Form1
{
    /// <summary>
    /// 必需的設(shè)計(jì)器變量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的資源。
    /// </summary>
    /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗體設(shè)計(jì)器生成的代碼

    /// <summary>
    /// 設(shè)計(jì)器支持所需的方法 - 不要
    /// 使用代碼編輯器修改此方法的內(nèi)容。
    /// </summary>
    private void InitializeComponent()
    {
        this.components = new System.ComponentModel.Container();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.listBox1 = new System.Windows.Forms.ListBox();
        this.label2 = new System.Windows.Forms.Label();
        this.comboBox1 = new System.Windows.Forms.ComboBox();
        this.label1 = new System.Windows.Forms.Label();
        this.groupBox2 = new System.Windows.Forms.GroupBox();
        this.button1 = new System.Windows.Forms.Button();
        this.label4 = new System.Windows.Forms.Label();
        this.textBox2 = new System.Windows.Forms.TextBox();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.label3 = new System.Windows.Forms.Label();
        this.timer1 = new System.Windows.Forms.Timer(this.components);
        this.listView1 = new System.Windows.Forms.ListView();
        this.progressBar1 = new System.Windows.Forms.ProgressBar();
        this.groupBox1.SuspendLayout();
        this.groupBox2.SuspendLayout();
        this.SuspendLayout();
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.listBox1);
        this.groupBox1.Controls.Add(this.label2);
        this.groupBox1.Controls.Add(this.comboBox1);
        this.groupBox1.Controls.Add(this.label1);
        this.groupBox1.Location = new System.Drawing.Point(8, 7);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(127, 225);
        this.groupBox1.TabIndex = 0;
        this.groupBox1.TabStop = false;
        this.groupBox1.Text = "選擇計(jì)算機(jī)";
        // 
        // listBox1
        // 
        this.listBox1.FormattingEnabled = true;
        this.listBox1.ItemHeight = 12;
        this.listBox1.Location = new System.Drawing.Point(22, 81);
        this.listBox1.Name = "listBox1";
        this.listBox1.Size = new System.Drawing.Size(94, 136);
        this.listBox1.TabIndex = 3;
        this.listBox1.Click += new System.EventHandler(this.listBox1_Click);
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(10, 65);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(53, 12);
        this.label2.TabIndex = 2;
        this.label2.Text = "計(jì)算機(jī):";
        // 
        // comboBox1
        // 
        this.comboBox1.FormattingEnabled = true;
        this.comboBox1.Location = new System.Drawing.Point(22, 39);
        this.comboBox1.Name = "comboBox1";
        this.comboBox1.Size = new System.Drawing.Size(94, 20);
        this.comboBox1.TabIndex = 1;
        this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(10, 22);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(53, 12);
        this.label1.TabIndex = 0;
        this.label1.Text = "工作組:";
        // 
        // groupBox2
        // 
        this.groupBox2.Controls.Add(this.listView1);
        this.groupBox2.Controls.Add(this.button1);
        this.groupBox2.Controls.Add(this.label4);
        this.groupBox2.Controls.Add(this.textBox2);
        this.groupBox2.Controls.Add(this.textBox1);
        this.groupBox2.Controls.Add(this.label3);
        this.groupBox2.Location = new System.Drawing.Point(142, 7);
        this.groupBox2.Name = "groupBox2";
        this.groupBox2.Size = new System.Drawing.Size(196, 225);
        this.groupBox2.TabIndex = 1;
        this.groupBox2.TabStop = false;
        this.groupBox2.Text = "掃描計(jì)算機(jī)已用端口號";
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(147, 38);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(41, 23);
        this.button1.TabIndex = 5;
        this.button1.Text = "掃描";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // label4
        // 
        this.label4.AutoSize = true;
        this.label4.Location = new System.Drawing.Point(70, 43);
        this.label4.Name = "label4";
        this.label4.Size = new System.Drawing.Size(17, 12);
        this.label4.TabIndex = 4;
        this.label4.Text = "到";
        // 
        // textBox2
        // 
        this.textBox2.Location = new System.Drawing.Point(88, 39);
        this.textBox2.Name = "textBox2";
        this.textBox2.Size = new System.Drawing.Size(51, 21);
        this.textBox2.TabIndex = 3;
        // 
        // textBox1
        // 
        this.textBox1.Location = new System.Drawing.Point(16, 39);
        this.textBox1.Name = "textBox1";
        this.textBox1.Size = new System.Drawing.Size(51, 21);
        this.textBox1.TabIndex = 2;
        // 
        // label3
        // 
        this.label3.AutoSize = true;
        this.label3.Location = new System.Drawing.Point(8, 21);
        this.label3.Name = "label3";
        this.label3.Size = new System.Drawing.Size(125, 12);
        this.label3.TabIndex = 1;
        this.label3.Text = "請?jiān)O(shè)定端口掃描范圍:";
        // 
        // timer1
        // 
        this.timer1.Interval = 1000;
        this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
        // 
        // listView1
        // 
        this.listView1.Location = new System.Drawing.Point(16, 67);
        this.listView1.Name = "listView1";
        this.listView1.Size = new System.Drawing.Size(172, 150);
        this.listView1.TabIndex = 6;
        this.listView1.UseCompatibleStateImageBehavior = false;
        this.listView1.View = System.Windows.Forms.View.SmallIcon;
        // 
        // progressBar1
        // 
        this.progressBar1.Dock = System.Windows.Forms.DockStyle.Bottom;
        this.progressBar1.Location = new System.Drawing.Point(0, 236);
        this.progressBar1.Name = "progressBar1";
        this.progressBar1.Size = new System.Drawing.Size(342, 15);
        this.progressBar1.TabIndex = 2;
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(342, 251);
        this.Controls.Add(this.progressBar1);
        this.Controls.Add(this.groupBox2);
        this.Controls.Add(this.groupBox1);
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "局域網(wǎng)端口掃描";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.groupBox2.ResumeLayout(false);
        this.groupBox2.PerformLayout();
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.ListBox listBox1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.ComboBox comboBox1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.GroupBox groupBox2;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Timer timer1;
    private System.Windows.Forms.ListView listView1;
    private System.Windows.Forms.ProgressBar progressBar1;
}

到此這篇關(guān)于C#實(shí)現(xiàn)掃描局域網(wǎng)內(nèi)的所有IP和端口的文章就介紹到這了,更多相關(guān)C#掃描局域網(wǎng)IP端口內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 如何使用C#掃描并讀取圖片中的文字

    如何使用C#掃描并讀取圖片中的文字

    本文介紹如何通過C# 程序來掃描并讀取圖片中的文字,這里以創(chuàng)建一個.Net Core程序?yàn)槔?。下面是具體步驟,供參考。有此需求的朋友可以了解下
    2021-06-06
  • C#異步編程幾點(diǎn)需要注意的地方

    C#異步編程幾點(diǎn)需要注意的地方

    這篇文章我們來討論下關(guān)于C#異步編程幾個不成文的建議,希望對你寫出高性能的異步編程代碼有所幫助
    2020-05-05
  • C#排序算法之快速排序解析

    C#排序算法之快速排序解析

    這篇文章主要為大家詳細(xì)介紹了C#排序算法之快速排序,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2020-01-01
  • C#.NET實(shí)現(xiàn)網(wǎng)頁自動登錄的方法

    C#.NET實(shí)現(xiàn)網(wǎng)頁自動登錄的方法

    這篇文章主要介紹了C#.NET實(shí)現(xiàn)網(wǎng)頁自動登錄的方法,以實(shí)例形式分析了C#實(shí)現(xiàn)點(diǎn)擊自動登錄的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-09-09
  • Url相對路徑的問題總結(jié)

    Url相對路徑的問題總結(jié)

    很多時候,我們在圖片或者其他(a標(biāo)簽,flash)中指定鏈接的時候,我們需要選擇是使用絕對路徑,或者是相對路徑.
    2012-11-11
  • 使用C#實(shí)現(xiàn)簡單的線性回歸的代碼詳解

    使用C#實(shí)現(xiàn)簡單的線性回歸的代碼詳解

    最近注意到了NumSharp,想學(xué)習(xí)一下,最好的學(xué)習(xí)方式就是去實(shí)踐,因此從github上找了一個用python實(shí)現(xiàn)的簡單線性回歸代碼,然后基于NumSharp用C#進(jìn)行了改寫,需要的朋友可以參考下
    2024-01-01
  • 快速解決C# android base-64 字符數(shù)組的無效長度問題

    快速解決C# android base-64 字符數(shù)組的無效長度問題

    下面小編就為大家?guī)硪黄焖俳鉀QC# android base-64 字符數(shù)組的無效長度問題。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-08-08
  • C#使用Chart繪制曲線

    C#使用Chart繪制曲線

    這篇文章主要為大家詳細(xì)介紹了C#使用Chart繪制曲線,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • C#實(shí)現(xiàn)FFT(遞歸法)的示例代碼

    C#實(shí)現(xiàn)FFT(遞歸法)的示例代碼

    FFT是數(shù)字信號處理中的重要算法。這篇文章將為大家詳細(xì)介紹一下如何利用C#語言實(shí)現(xiàn)FFT(遞歸法),文中的示例代碼講解詳細(xì),感興趣的可以了解一下
    2022-07-07
  • C# 計(jì)算標(biāo)準(zhǔn)偏差相當(dāng)于Excel中的STDEV函數(shù)實(shí)例

    C# 計(jì)算標(biāo)準(zhǔn)偏差相當(dāng)于Excel中的STDEV函數(shù)實(shí)例

    下面小編就為大家?guī)硪黄狢# 計(jì)算標(biāo)準(zhǔn)偏差相當(dāng)于Excel中的STDEV函數(shù)實(shí)例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-01-01

最新評論