Esempio n. 1
0
        public void Start()
        {
            Connection = new YGOClient();
            _behavior  = new GameBehavior(this);

            Connection.Connected      += OnConnected;
            Connection.PacketReceived += OnPacketReceived;

            Connection.Connect(IPAddress.Parse(_serverHost), _serverPort);
        }
Esempio n. 2
0
        public void Start()
        {
            Connection = new YGOClient();
            _behavior  = new GameBehavior(this);

            Connection.Connected      += OnConnected;
            Connection.PacketReceived += OnPacketReceived;
            IPAddress target_address;

            try {
                target_address = IPAddress.Parse(_serverHost);
            } catch (System.Exception e) {
                IPHostEntry _hostEntry = Dns.GetHostEntry(_serverHost);
                target_address = _hostEntry.AddressList[0];
            }
            Connection.Connect(target_address, _serverPort);
        }
Esempio n. 3
0
        public void Start()
        {
            Connection = new YGOClient();
            _behavior  = new GameBehavior(this);

            Connection.Connected      += OnConnected;
            Connection.PacketReceived += OnPacketReceived;

            IPAddress target_address;

            try
            {
                target_address = IPAddress.Parse(_serverHost);
            }
            catch (System.Exception)
            {
                IPHostEntry _hostEntry = Dns.GetHostEntry(_serverHost);
                target_address = _hostEntry.AddressList.FirstOrDefault(findIPv4 => findIPv4.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
            }

            Connection.Connect(target_address, _serverPort);
        }