コード例 #1
0
 /// <summary>
 /// try register server node.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="endPoint"></param>
 /// <returns></returns>
 public bool TryRegisterNode(string name, EndPoint endPoint)
 {
     SocketConnector node = null;
     lock (this)
     {
         if (this._dicNodes.ContainsKey(name)) return false;
         this._dicNodes[name] = node = new SocketConnector(name, endPoint, this._host,
             this.OnConnected, this.OnDisconnected);
     }
     node.Start();
     return true;
 }
コード例 #2
0
        /// <summary>
        /// try register server node.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="endPoint"></param>
        /// <returns></returns>
        public bool TryRegisterNode(string name, EndPoint endPoint)
        {
            SocketConnector node = null;

            lock (this)
            {
                if (this._dicNodes.ContainsKey(name))
                {
                    return(false);
                }
                this._dicNodes[name] = node = new SocketConnector(name, endPoint, this._host,
                                                                  this.OnConnected, this.OnDisconnected);
            }
            node.Start();
            return(true);
        }
        /// <summary>
        /// try register server node.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="endPoint"></param>
        /// <returns></returns>
        public bool TryRegisterNode(string name, EndPoint endPoint)
        {
            SocketConnector connector = null;

            lock (this)
            {
                if (this._dicNodes.ContainsKey(name))
                {
                    return(false);
                }

                connector               = new SocketConnector(name, endPoint, this._host);
                connector.Connected    += this.OnConnected;
                connector.Disconnected += this.OnDisconnected;
                this._dicNodes[name]    = connector;
            }
            connector.Start();
            return(true);
        }