public static void MainThread() { while (SysFlag.ServiceStart) { try { Socket client = Configs.UserSock.Accept();//当有可用的客户端连接尝试时执行,并返回一个新的socket,用于与客户端之间的通信 UserFace newclient = new UserFace(client); Thread newthread = new Thread(new ThreadStart(newclient.ClientService)); newthread.Start(); if (!SysFlag.ServiceStart) { client.Close(); return; } } catch (Exception E) { CreateInfor.WriteLogs(E.Message + "导致【错误处于客户端侦听循环】"); } } Configs.UserSock.Close(); CreateInfor.WriteLogs("用户访问通道关闭!"); }
private static void FaceThread() { UserFace.MainThread(); }