コード例 #1
0
 /**
  *
  */
 public void ResetServerAddressStatus()
 {
     for (int i = 0; i < _ipAddressArry.Length; i++)
     {
         IPaddressWrapper _wrapper = _ipAddressArry [i];
         _wrapper.isTried   = false;
         _ipAddressArry [i] = _wrapper;
     }
     ConnectState = EClientConnectState.CONNECT_STATE_NONE;
 }
コード例 #2
0
        /**
         *
         */
        private void InitIpAddressArry(String serverIp, String ports)
        {
            IPAddress _ipAddress = IPAddress.Parse(serverIp);

            string[] _tempArray = ports.Split(',');
            int      _portSize  = _tempArray.Length;

            _ipAddressArry = new IPaddressWrapper[_portSize];
            for (int i = 0; i < _portSize; i++)
            {
                int _port = Convert.ToInt32(_tempArray [i].Trim());
                IPaddressWrapper _addressWrapper = new IPaddressWrapper();
                _addressWrapper.ipPoint = new IPEndPoint(_ipAddress, _port);
                _addressWrapper.isTried = false;
                _ipAddressArry [i]      = _addressWrapper;
            }
        }
コード例 #3
0
        /**
         *
         */
        private IPEndPoint GetServerAddress()
        {
            for (int i = 0; i < _ipAddressArry.Length; i++)
            {
                IPaddressWrapper _wrapper = _ipAddressArry [i];
                //
                if (_wrapper.isTried)
                {
                    continue;
                }
                _wrapper.isTried = true;
                // FIXME why
                _ipAddressArry [i] = _wrapper;
                Console.WriteLine("Try to connect : " + _wrapper.ipPoint);
                return(_wrapper.ipPoint);
            }

            return(null);
        }