Пример #1
0
 public void RemoveClient(LiveClientSide client)
 {
     if (clients.Contains(client))
     {
         clients.Remove(client);
     }
 }
Пример #2
0
 public void AddClient(LiveClientSide client)
 {
     if (clients.Contains(client))
     {
         return;
     }
     clients.Add(client);
 }
Пример #3
0
        public void Send(string msg, string clientID)
        {
            LiveClientSide Client = GetClientByID(clientID);

            if (Client == null)
            {
                Debug.Error(string.Format("指定的客户端ID不存在:{0}", clientID));
                return;
            }
            Send(msg, Client.Client);
        }
Пример #4
0
        public LiveClientSide GetClientBySocket(Socket socket)
        {
            LiveClientSide client = null;

            foreach (LiveClientSide ls in clients)
            {
                if (ls.Client == socket)
                {
                    client = ls;
                    break;
                }
            }
            return(client);
        }
Пример #5
0
        public LiveClientSide GetClientByPort(string ip, int port)
        {
            LiveClientSide client = null;

            foreach (LiveClientSide ls in clients)
            {
                if (ls.IP == ip && ls.Port == port)
                {
                    client = ls;
                    break;
                }
            }
            return(client);
        }