/// <summary> /// 向所有的客户端广播消息 /// </summary> public void Broadcast(string message) { if (m_handlerList == null) { return; } if (m_handlerList.Count <= 0) { return; } //遍历客户端列表并发送消息 foreach (Socket handler in m_handlerList) { SocketSender sender = new SocketSender(handler); sender.Send(message); } }
/// <summary> /// 发送消息 /// </summary> /// <param name="message"></param> public void Send(string message) { SocketSender sender = new SocketSender(m_handler); sender.Send(message); }