public override void Close() { if (Status == ServiceHostStatus.Stopped) { throw new InvalidOperationException("服务已经关闭。"); } Status = ServiceHostStatus.Stopped; HostSocket.Close(); HostSocket.Dispose(); ConnectionCheckTimer.Enabled = false; while (ActiveClients.Count > 0) { var client = (SocketActiveClient)ActiveClients[0]; client.Close(); } ActiveClients.Clear(); HostSocket = null; }
public void Reset() { ActiveClients.Clear(); }