c#Socket Tcp服务端编程
转自 https://www.cnblogs.com/kellen451/p/7127670.html 1 /* 2 * 3 * 该类用于管理tcp连接通讯 4 * 5 */ 6 7 using System; 8 using System.Collections.Generic; 9 using System.Net.Sockets; 10 using System.Threading; 11 using System.Net; 12 13 namespace Communication 14 { 15 /// <summary> 16 /// 服务端 17 /// </summary> 18 public class MyTcpServer 19 { 20 21 private Socket ServerSocket = null ; // 服务端 22 public Dictionary< string , MySession> dic_ClientSocket = new Dictionary< string , MySession>(); // tcp客户端字典 23 private Dictionary< string , Thread> dic_ClientThread = new Dictionary< string , Thread>(); // 线程字典