I was fortunate enough to buy a CD with Visual Studio. NET, and hastily install a set, a very good feeling, learn to write Port scanner one, dedicated to this edition of Friends:
Using System;;
Using System.Drawing;;
using System.Collections;;
Using System.ComponentModel;;
Using System.Windows.Forms;;
Add the following.
using System.Data;;
Using System.Net.Sockets;;
using System.Net;;
Using System.IO;;
using System.Text;;
using System.Threading;;
Namespace Iportscan
{
〈summary〉
Summary description for Form1.
〈/summary〉
public class Form1:System.Windows.Forms.Form
{
This is where the public variables that the program is going to use
public string scanhost = Dns.gethostname ();;//default current native IP
Public Int32 tport = 0;;//Current Connection port number
Public Int32 connstate = 0;;//Scan status
public int portsum = 0;;//Port totals
public bool Endthread = false;;//End State
Public AutoResetEvent Asyncopsaredone = new AutoResetEvent (false);;
Private System.Windows.Forms.Label Label1;;
Private System.Windows.Forms.TextBox txthostname;;
Private System.Windows.Forms.Button CmdExec;;
Private System.Windows.Forms.ListBox loglist;;
public System.Windows.Forms.CheckedListBox portlist;;
Private System.Windows.Forms.Label label2;;
Private System.Windows.Forms.Label label3;;
Private System.Windows.Forms.NumericUpDown snum;;
Private System.Windows.Forms.NumericUpDown eNum;;
Private System.Windows.Forms.CheckBox Showdie;;
Private System.Windows.Forms.Label label4;;
Private System.Windows.Forms.Button button1;;
Private System.Windows.Forms.ToolTip toolTip1;;
Private System.Windows.Forms.StatusBar statusBar1;;
Private System.Windows.Forms.LinkLabel linkLabel1;;
Private System.Windows.Forms.LinkLabel linkLabel2;;
private System.ComponentModel.IContainer components;;
/*
The property settings code for each called control is omitted here
*/
static void Main ()
{
Application.Run (New Form1 ());
}
private void Cmdexec_click (object sender, System.EventArgs e)
{
Int32 Startport = (Int32) snum.value;;
Int32 Endport = (Int32) enum.value;;
if (txthostname.text.length==0)
{
MessageBox.Show ("Please enter the name of a host!") "," System hints ");;
Txthostname.text = Scanhost.tostring ();;
Txthostname.focus ();;
return;;
}
if (Startport〉endport)
{
MessageBox.Show ("error, starting port must be less than end port!", "System Prompt");;
Startport = endPort-1;;
Snum.text = Startport.tostring ();;
Snum.focus ();;
return;;
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.