📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Diagnostics;
using System.Text;
using System.IO;
namespace MySendServer
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Button button5;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
Socket socketS,socketC,socketR;
string IP;//本地主机的IP
IPAddress ip;//远程主机的ip
int PortS;//本机(Server)开放的端口
int PortC;//远程主机(Client)开放的端口
Thread td1,td2;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox textBox6;
string text; //获得的消息
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.button3 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.listBox1 = new System.Windows.Forms.ListBox();
this.label9 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(456, 24);
this.button1.Name = "button1";
this.button1.TabIndex = 15;
this.button1.Text = "发送";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(304, 152);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(312, 176);
this.richTextBox1.TabIndex = 14;
this.richTextBox1.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(240, 80);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 16);
this.label3.TabIndex = 13;
this.label3.Text = "发送消息";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(304, 80);
this.textBox3.Multiline = true;
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(272, 40);
this.textBox3.TabIndex = 12;
this.textBox3.Text = "";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(304, 8);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 10;
this.textBox1.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(248, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 16);
this.label2.TabIndex = 9;
this.label2.Text = "端口号:";
//
// label1
//
this.label1.Location = new System.Drawing.Point(248, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 16);
this.label1.TabIndex = 8;
this.label1.Text = "IP地址:";
//
// label4
//
this.label4.Location = new System.Drawing.Point(264, 176);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 32);
this.label4.TabIndex = 16;
this.label4.Text = "接收消息";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(304, 40);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(72, 21);
this.textBox2.TabIndex = 17;
this.textBox2.Text = "";
//
// linkLabel1
//
this.linkLabel1.Location = new System.Drawing.Point(304, 128);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(80, 16);
this.linkLabel1.TabIndex = 19;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "有关指令帮助";
this.linkLabel1.Click += new System.EventHandler(this.linkLabel1_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(24, 80);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 24);
this.button3.TabIndex = 21;
this.button3.Text = "开始";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.numericUpDown1);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.numericUpDown2);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Location = new System.Drawing.Point(584, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(128, 112);
this.groupBox1.TabIndex = 22;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "扫描肉鸡的端口";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(72, 16);
this.numericUpDown1.Maximum = new System.Decimal(new int[] {
65535,
0,
0,
0});
this.numericUpDown1.Minimum = new System.Decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(48, 21);
this.numericUpDown1.TabIndex = 1;
this.numericUpDown1.Value = new System.Decimal(new int[] {
1,
0,
0,
0});
//
// label5
//
this.label5.Location = new System.Drawing.Point(8, 24);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 16);
this.label5.TabIndex = 0;
this.label5.Text = "起始端口";
//
// label6
//
this.label6.Location = new System.Drawing.Point(8, 56);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 16);
this.label6.TabIndex = 0;
this.label6.Text = "结束端口";
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(72, 48);
this.numericUpDown2.Maximum = new System.Decimal(new int[] {
65535,
0,
0,
0});
this.numericUpDown2.Minimum = new System.Decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(48, 21);
this.numericUpDown2.TabIndex = 1;
this.numericUpDown2.Value = new System.Decimal(new int[] {
1,
0,
0,
0});
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textBox6);
this.groupBox2.Controls.Add(this.button5);
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.textBox5);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.textBox4);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Location = new System.Drawing.Point(240, 344);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(328, 112);
this.groupBox2.TabIndex = 23;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "文件传送";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(88, 80);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(64, 21);
this.textBox6.TabIndex = 27;
this.textBox6.Text = "";
//
// button5
//
this.button5.Location = new System.Drawing.Point(192, 80);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(88, 24);
this.button5.TabIndex = 6;
this.button5.Text = "发送";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(256, 48);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(56, 23);
this.button4.TabIndex = 5;
this.button4.Text = "确定";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(88, 48);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(144, 21);
this.textBox5.TabIndex = 4;
this.textBox5.Text = "";
//
// label8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -