/** * */ 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; }
/** * */ 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; } }
/** * */ 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); }