初始化版本
This commit is contained in:
6
tongxin/Socket.Client/App.config
Normal file
6
tongxin/Socket.Client/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
287
tongxin/Socket.Client/FrmClient.Designer.cs
generated
Normal file
287
tongxin/Socket.Client/FrmClient.Designer.cs
generated
Normal file
@@ -0,0 +1,287 @@
|
||||
namespace Client
|
||||
{
|
||||
partial class FrmClient
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows 窗体设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.txtServerPort = new System.Windows.Forms.TextBox();
|
||||
this.txtServerIp = new System.Windows.Forms.TextBox();
|
||||
this.btnConnect = new System.Windows.Forms.Button();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.txtInterval = new System.Windows.Forms.TextBox();
|
||||
this.chBoxIsHeartCheck = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.txtReceviceData = new System.Windows.Forms.RichTextBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.txtSendData = new System.Windows.Forms.TextBox();
|
||||
this.btnSendData = new System.Windows.Forms.Button();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.txtMessage = new System.Windows.Forms.RichTextBox();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(38, 98);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(77, 12);
|
||||
this.label5.TabIndex = 38;
|
||||
this.label5.Text = "服务器端口:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(50, 52);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(65, 12);
|
||||
this.label6.TabIndex = 37;
|
||||
this.label6.Text = "服务器IP:";
|
||||
//
|
||||
// txtServerPort
|
||||
//
|
||||
this.txtServerPort.Location = new System.Drawing.Point(121, 94);
|
||||
this.txtServerPort.Name = "txtServerPort";
|
||||
this.txtServerPort.Size = new System.Drawing.Size(202, 21);
|
||||
this.txtServerPort.TabIndex = 1;
|
||||
this.txtServerPort.Text = "7001";
|
||||
//
|
||||
// txtServerIp
|
||||
//
|
||||
this.txtServerIp.Location = new System.Drawing.Point(121, 48);
|
||||
this.txtServerIp.Name = "txtServerIp";
|
||||
this.txtServerIp.Size = new System.Drawing.Size(202, 21);
|
||||
this.txtServerIp.TabIndex = 0;
|
||||
this.txtServerIp.Text = "192.168.1.5";
|
||||
//
|
||||
// btnConnect
|
||||
//
|
||||
this.btnConnect.Location = new System.Drawing.Point(127, 187);
|
||||
this.btnConnect.Name = "btnConnect";
|
||||
this.btnConnect.Size = new System.Drawing.Size(106, 33);
|
||||
this.btnConnect.TabIndex = 2;
|
||||
this.btnConnect.Text = "连接";
|
||||
this.btnConnect.UseVisualStyleBackColor = true;
|
||||
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.txtInterval);
|
||||
this.groupBox3.Controls.Add(this.chBoxIsHeartCheck);
|
||||
this.groupBox3.Controls.Add(this.label3);
|
||||
this.groupBox3.Controls.Add(this.label5);
|
||||
this.groupBox3.Controls.Add(this.label6);
|
||||
this.groupBox3.Controls.Add(this.txtServerPort);
|
||||
this.groupBox3.Controls.Add(this.txtServerIp);
|
||||
this.groupBox3.Controls.Add(this.btnConnect);
|
||||
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupBox3.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(360, 258);
|
||||
this.groupBox3.TabIndex = 68;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "客户端参数设置";
|
||||
//
|
||||
// txtInterval
|
||||
//
|
||||
this.txtInterval.Location = new System.Drawing.Point(288, 147);
|
||||
this.txtInterval.Name = "txtInterval";
|
||||
this.txtInterval.Size = new System.Drawing.Size(35, 21);
|
||||
this.txtInterval.TabIndex = 41;
|
||||
this.txtInterval.Text = "40";
|
||||
//
|
||||
// chBoxIsHeartCheck
|
||||
//
|
||||
this.chBoxIsHeartCheck.AutoSize = true;
|
||||
this.chBoxIsHeartCheck.Checked = true;
|
||||
this.chBoxIsHeartCheck.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chBoxIsHeartCheck.Location = new System.Drawing.Point(121, 149);
|
||||
this.chBoxIsHeartCheck.Name = "chBoxIsHeartCheck";
|
||||
this.chBoxIsHeartCheck.Size = new System.Drawing.Size(72, 16);
|
||||
this.chBoxIsHeartCheck.TabIndex = 39;
|
||||
this.chBoxIsHeartCheck.Text = "心跳检测";
|
||||
this.chBoxIsHeartCheck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(219, 151);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(65, 12);
|
||||
this.label3.TabIndex = 40;
|
||||
this.label3.Text = "间隔(秒):";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.groupBox1);
|
||||
this.panel1.Controls.Add(this.groupBox2);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(370, 10);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
|
||||
this.panel1.Size = new System.Drawing.Size(616, 690);
|
||||
this.panel1.TabIndex = 73;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtReceviceData);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Location = new System.Drawing.Point(10, 0);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(606, 620);
|
||||
this.groupBox1.TabIndex = 2;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "已接收数据";
|
||||
//
|
||||
// txtReceviceData
|
||||
//
|
||||
this.txtReceviceData.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtReceviceData.Location = new System.Drawing.Point(3, 17);
|
||||
this.txtReceviceData.Name = "txtReceviceData";
|
||||
this.txtReceviceData.ReadOnly = true;
|
||||
this.txtReceviceData.Size = new System.Drawing.Size(600, 600);
|
||||
this.txtReceviceData.TabIndex = 100;
|
||||
this.txtReceviceData.Text = "";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.txtSendData);
|
||||
this.groupBox2.Controls.Add(this.btnSendData);
|
||||
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.groupBox2.Location = new System.Drawing.Point(10, 620);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(606, 70);
|
||||
this.groupBox2.TabIndex = 3;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "发送数据";
|
||||
//
|
||||
// txtSendData
|
||||
//
|
||||
this.txtSendData.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtSendData.Location = new System.Drawing.Point(3, 17);
|
||||
this.txtSendData.Multiline = true;
|
||||
this.txtSendData.Name = "txtSendData";
|
||||
this.txtSendData.Size = new System.Drawing.Size(525, 50);
|
||||
this.txtSendData.TabIndex = 0;
|
||||
//
|
||||
// btnSendData
|
||||
//
|
||||
this.btnSendData.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnSendData.Location = new System.Drawing.Point(528, 17);
|
||||
this.btnSendData.Name = "btnSendData";
|
||||
this.btnSendData.Size = new System.Drawing.Size(75, 50);
|
||||
this.btnSendData.TabIndex = 1;
|
||||
this.btnSendData.Text = "发送数据";
|
||||
this.btnSendData.UseVisualStyleBackColor = true;
|
||||
this.btnSendData.Click += new System.EventHandler(this.btnSendData_Click);
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.groupBox4);
|
||||
this.panel2.Controls.Add(this.groupBox3);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panel2.Location = new System.Drawing.Point(10, 10);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(360, 690);
|
||||
this.panel2.TabIndex = 74;
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.txtMessage);
|
||||
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox4.Location = new System.Drawing.Point(0, 258);
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.Size = new System.Drawing.Size(360, 432);
|
||||
this.groupBox4.TabIndex = 69;
|
||||
this.groupBox4.TabStop = false;
|
||||
this.groupBox4.Text = "消息";
|
||||
//
|
||||
// txtMessage
|
||||
//
|
||||
this.txtMessage.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtMessage.Location = new System.Drawing.Point(3, 17);
|
||||
this.txtMessage.Name = "txtMessage";
|
||||
this.txtMessage.ReadOnly = true;
|
||||
this.txtMessage.Size = new System.Drawing.Size(354, 412);
|
||||
this.txtMessage.TabIndex = 101;
|
||||
this.txtMessage.Text = "";
|
||||
//
|
||||
// FrmClient
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(996, 710);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Name = "FrmClient";
|
||||
this.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.Text = "主窗体";
|
||||
this.Load += new System.EventHandler(this.FrmClient_Load);
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox txtServerPort;
|
||||
private System.Windows.Forms.TextBox txtServerIp;
|
||||
private System.Windows.Forms.Button btnConnect;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.RichTextBox txtReceviceData;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TextBox txtSendData;
|
||||
private System.Windows.Forms.Button btnSendData;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
private System.Windows.Forms.RichTextBox txtMessage;
|
||||
private System.Windows.Forms.TextBox txtInterval;
|
||||
private System.Windows.Forms.CheckBox chBoxIsHeartCheck;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
||||
|
||||
171
tongxin/Socket.Client/FrmClient.cs
Normal file
171
tongxin/Socket.Client/FrmClient.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using NetWorkHelper;
|
||||
using NetWorkHelper.TCP;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
public partial class FrmClient : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接状态
|
||||
/// </summary>
|
||||
SocketState _connectState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接对象
|
||||
/// </summary>
|
||||
ITcpClient _client { get; set; }
|
||||
|
||||
System.Timers.Timer _timer { get; set; }
|
||||
|
||||
System.Timers.Timer _timerPone { get; set; }
|
||||
|
||||
private const string pingPong = "客户端心跳包";
|
||||
|
||||
|
||||
public FrmClient()
|
||||
{
|
||||
InitializeComponent();
|
||||
_timerPone = new System.Timers.Timer();
|
||||
}
|
||||
|
||||
private void FrmClient_Load(object sender, EventArgs e)
|
||||
{
|
||||
_client = new ITcpClient();
|
||||
_client.IsReconnection = true;
|
||||
|
||||
_client.OnStateInfo += Client_OnStateInfo;
|
||||
_client.OnRecevice += Client_OnRecevice;
|
||||
_client.OnErrorMsg += Client_OnErrorMsg;
|
||||
_timerPone.Elapsed += CloseConnect;
|
||||
_timerPone.Interval = 2000;
|
||||
_timerPone.AutoReset = false;
|
||||
|
||||
txtSendData.Focus();
|
||||
}
|
||||
|
||||
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
SendData("客户端心跳包:" + pingPong);
|
||||
_timerPone.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 连接按钮事件
|
||||
/// </summary>
|
||||
private void btnConnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!_client.IsStart)
|
||||
{
|
||||
if (chBoxIsHeartCheck.Checked)
|
||||
{
|
||||
if (string.IsNullOrEmpty(txtInterval.Text.Trim()))
|
||||
{
|
||||
MessageBox.Show("心跳间隔不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
int interval = int.Parse(txtInterval.Text.Trim());
|
||||
|
||||
_timer = new System.Timers.Timer();
|
||||
_timer.Interval = 1000 * interval;
|
||||
_timer.Elapsed += _timer_Elapsed;
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
_client.ServerIp = txtServerIp.Text.Trim();
|
||||
_client.ServerPort = int.Parse(txtServerPort.Text.Trim());
|
||||
|
||||
_client.StartConnect();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 连接错误
|
||||
/// </summary>
|
||||
private void Client_OnErrorMsg(object sender, NetWorkHelper.ICommond.TcpClientErrorEventArgs e)
|
||||
{
|
||||
txtMessage.AppendText(e.ErrorMsg + Environment.NewLine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 接收数据
|
||||
/// </summary>
|
||||
private void Client_OnRecevice(object sender, NetWorkHelper.ICommond.TcpClientReceviceEventArgs e)
|
||||
{
|
||||
string receviceData = Encoding.Default.GetString(e.Data);
|
||||
|
||||
if (receviceData == pingPong)
|
||||
{
|
||||
_timerPone.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
txtReceviceData.AppendText(receviceData + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 连接状态
|
||||
/// </summary>
|
||||
private void Client_OnStateInfo(object sender, NetWorkHelper.ICommond.TcpClientStateEventArgs e)
|
||||
{
|
||||
_connectState = e.State;
|
||||
|
||||
txtMessage.AppendText(e.StateInfo + Environment.NewLine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送数据
|
||||
/// </summary>
|
||||
private void btnSendData_Click(object sender, EventArgs e)
|
||||
{
|
||||
SendData(txtSendData.Text.Trim());
|
||||
}
|
||||
|
||||
void SendData(string data)
|
||||
{
|
||||
byte[] sendData = Encoding.Default.GetBytes(data);
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke((Action)delegate ()
|
||||
{
|
||||
_client.SendData(sendData);
|
||||
txtSendData.Text = string.Empty;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_client.SendData(sendData);
|
||||
txtSendData.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭连接
|
||||
/// </summary>
|
||||
private void ClientClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_client.IsStart)
|
||||
{
|
||||
_client.StopConnect();
|
||||
_client.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseConnect(object body, EventArgs e)
|
||||
{
|
||||
|
||||
_client.StopConnect();
|
||||
_client.StartConnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
tongxin/Socket.Client/FrmClient.resx
Normal file
120
tongxin/Socket.Client/FrmClient.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
22
tongxin/Socket.Client/Program.cs
Normal file
22
tongxin/Socket.Client/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Client
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FrmClient());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
tongxin/Socket.Client/Properties/AssemblyInfo.cs
Normal file
36
tongxin/Socket.Client/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Client")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Client")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("9badf8d4-7fef-4ab9-94d6-456d5aeeb204")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
tongxin/Socket.Client/Properties/Resources.Designer.cs
generated
Normal file
71
tongxin/Socket.Client/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Client.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Client.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 覆盖当前线程的 CurrentUICulture 属性
|
||||
/// 使用此强类型的资源类的资源查找。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
tongxin/Socket.Client/Properties/Resources.resx
Normal file
117
tongxin/Socket.Client/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
tongxin/Socket.Client/Properties/Settings.Designer.cs
generated
Normal file
30
tongxin/Socket.Client/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Client.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
tongxin/Socket.Client/Properties/Settings.settings
Normal file
7
tongxin/Socket.Client/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
89
tongxin/Socket.Client/Socket.Client.csproj
Normal file
89
tongxin/Socket.Client/Socket.Client.csproj
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9BADF8D4-7FEF-4AB9-94D6-456D5AEEB204}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Client</RootNamespace>
|
||||
<AssemblyName>Client</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FrmClient.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrmClient.Designer.cs">
|
||||
<DependentUpon>FrmClient.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FrmClient.resx">
|
||||
<DependentUpon>FrmClient.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NetWorkHelper\NetWorkHelper.csproj">
|
||||
<Project>{fb7970fd-f699-4093-83d0-509501b7863c}</Project>
|
||||
<Name>NetWorkHelper</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user