最近在学网络编程
就心血来潮做了一个TCP同步客户端
主要用到了TCPClient知识和回调知识
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;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace TCP同步客户端
{
public partial class Form1 : Form
{
#region 回调
private delegate void ShowMsgCallBack(string Msg);
ShowMsgCallBack showMsgCallBack;
#endregion
#region 字段
TcpClient myTcpClient;
NetworkStream ns;
Thread receiveThread;
#endregion
#region 窗体事件
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
showMsgCallBa