/// <summary> /// /// </summary> /// <param name="this1"></param> public bool Remove(SocketListener item) { if (this.SocketListeners.Remove(item)) { UnregisterEvents(item); return true; } return false; }
/// <summary> /// /// </summary> /// <param name="soft"></param> public void Build(SocketListenerManager socketListenerManager) { XmlDocument doc = new XmlDocument(); doc.Load(_filename); XmlNode node = doc.SelectSingleNode(XmlListenNodeNames.ListenPortCollection); if (node != null) { foreach (XmlNode n in node.ChildNodes) { if (n.Name == XmlListenNodeNames.ListenPort) { int port = int.Parse(n.InnerText); SocketListener sckListener = new SocketListener(port); sckListener.Start(); socketListenerManager.Add(sckListener); } } } }
/// <summary> /// /// </summary> /// <param name="this1"></param> private void ReginsterEvents(SocketListener item) { item.ConnectedEvent += new EventHandler(item_ConnectedEvent); }
/// <summary> /// 添加item到SocketListeners集合,并注册NewConnect事件 /// </summary> /// <param name="this1"></param> public void Add(SocketListener item) { this.SocketListeners.Add(item); ReginsterEvents(item); }
/// <summary> /// /// </summary> /// <param name="this1"></param> private void UnregisterEvents(SocketListener item) { item.ConnectedEvent -= new EventHandler(item_ConnectedEvent); }