3.代码实现 服务器端包含一个主函数和一个ServerControl类 主函数: using System; using System.Collections.Generic; using System.Linq { static void Main(string[] args) { // 调用构造函数,使用Start方法 ServerControl server = new ServerControl(); server.Start(); Console.ReadKey(); } } } ServerControl类: using System; using System.Collections.Generic; using System.Linq; using System.Net private List<Socket> clientList; // 自定义有参构造函数,包含两个方法(IP地址,流程传输方式,TCP协议) public ServerControl
{ static void Main(string[] args) { // 调用构造函数,使用Start方法 ServerControl server = new ServerControl(); server.Start(); Console.ReadKey(); } } } ServerControl类: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ServerTest { public class ServerControl System.Net.Sockets;) private Socket serverSocket; // 自定义有参构造方法(IP地址,流程传输方式,TCP协议) public ServerControl