Exemple #1
0
        public void Connect()
        {
            string[] address = realm.Address.Split(':');
            byte[]   test    = new byte[1];
            test[0] = 10;
            mCrypt  = new PacketCrypt(test);
            IPAddress  WSAddr = Dns.GetHostAddresses(address[0])[0];
            int        WSPort = Int32.Parse(address[1]);
            IPEndPoint ep     = new IPEndPoint(WSAddr, WSPort);

            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                mSocket.Connect(ep);
                Log.WriteLine(LogType.Success, "Successfully connected to WorldServer at: {0}!", realm.Address);
            }
            catch (SocketException ex)
            {
                Log.WriteLine(LogType.Error, "Failed to connect to realm: {0}", ex.Message);
                Disconnect();
                return;
            }

            byte[] nullA = new byte[24];
            mCrypt    = new PacketCrypt(nullA);
            Connected = true;
            pHandler  = new PacketHandler(this);
            pLoop     = new PacketLoop(this, mSocket);
            pLoop.Start();
            pHandler.Initialize();
        }
Exemple #2
0
        public void Connect()
        {
            string host = mHost;
            int    port = mPort;

            Regex     DnsMatch = new Regex("[a-zA-Z]");
            IPAddress ASAddr;

            try
            {
                if (DnsMatch.IsMatch(host))
                {
                    ASAddr = Dns.GetHostEntry(host).AddressList[0];
                }
                else
                {
                    ASAddr = System.Net.IPAddress.Parse(host);
                }

                IPEndPoint ASDest = new IPEndPoint(ASAddr, port);

                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

                Log.WriteLine(LogType.Normal, "Attempting to connect to Logon Server at {0}:{1}", host, port);
                mSocket.Connect(ASDest);
            }
            catch (Exception ex)
            {
                Log.WriteLine(LogType.Error, "Exception Occured");
                Log.WriteLine(LogType.Error, "Message: {0}", ex.Message);
                Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace);
                Disconnect();
                return;
            }

            Log.WriteLine(LogType.Success, "Succesfully connected to Logon Server at {0}:{1}", host, port);

            Connected = true;
            pHandler  = new PacketHandler(this);
            pLoop     = new PacketLoop(this, mSocket);
            pHandler.Initialize();
            Authenticate();
        }
Exemple #3
0
        public void Connect()
        {
            string[] address = realm.Address.Split(':');
            byte[] test = new byte[1];
            test[0] = 10;
            mCrypt = new PacketCrypt(test);
            IPAddress WSAddr = Dns.GetHostAddresses(address[0])[0];
            int WSPort = Int32.Parse(address[1]);
            IPEndPoint ep = new IPEndPoint(WSAddr, WSPort);

            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                mSocket.Connect(ep);
                Log.WriteLine(LogType.Success, "Successfully connected to WorldServer at: {0}!", realm.Address);

            }
            catch (SocketException ex)
            {
                Log.WriteLine(LogType.Error, "Failed to connect to realm: {0}", ex.Message);
                Disconnect();
                return;
            }

            byte[] nullA = new byte[24];
            mCrypt = new PacketCrypt(nullA);
            Connected = true;
            pHandler = new PacketHandler(this);
            pLoop = new PacketLoop(this, mSocket);
            pLoop.Start();
            pHandler.Initialize();
        }
Exemple #4
0
        public void Connect()
        {
            string host = mHost;
            int port = mPort;

            Regex DnsMatch = new Regex("[a-zA-Z]");
            IPAddress ASAddr;

            try
            {
                if (DnsMatch.IsMatch(host))
                    ASAddr = Dns.GetHostEntry(host).AddressList[0];
                else
                    ASAddr = System.Net.IPAddress.Parse(host);

                IPEndPoint ASDest = new IPEndPoint(ASAddr, port);

                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

                Log.WriteLine(LogType.Normal, "Attempting to connect to Logon Server at {0}:{1}", host, port);
                mSocket.Connect(ASDest);
            }
            catch (Exception ex)
            {
                Log.WriteLine(LogType.Error, "Exception Occured");
                Log.WriteLine(LogType.Error, "Message: {0}", ex.Message);
                Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace);
                Disconnect();
                return;
            }

            Log.WriteLine(LogType.Success, "Succesfully connected to Logon Server at {0}:{1}", host, port);

            Connected = true;
            pHandler = new PacketHandler(this);
            pLoop = new PacketLoop(this, mSocket);
            pHandler.Initialize();
            Authenticate();
        }