Beispiel #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();
        }
Beispiel #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();
        }
Beispiel #3
0
        public bool Connect(IPEndPoint ep)
        {
            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

                Log.WriteLine(LogType.Normal, "Attempting to connect to Logon Server at {0}:{1}", ep.Address, ep.Port);
                mSocket.Connect(ep);
            }
            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 false;
            }

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

            Connected = true;
            pHandler = new PacketHandler(this);
            pLoop = new PacketLoop(this, mSocket);
            pHandler.Initialize();
            return true;
            //Authenticate();
        }
Beispiel #4
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];
            IPAddress wWSAddr = Dns.GetHostAddresses(WardenHost)[0];
            int WSPort = Int32.Parse(address[1]);
            IPEndPoint ep = new IPEndPoint(WSAddr, WSPort);
            IPEndPoint wep = new IPEndPoint(wWSAddr, WardenPort);

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

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

               /* try
            {
                mWardenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                mWardenSocket.Connect(wep);
            }
            catch (SocketException ex)
            {
                Log.WriteLine(LogType.Error, "Failed to connect to WardenServer: {0}", ex.Message);
                return;
            }*/

            byte[] nullA = new byte[24];
            mCrypt = new PacketCrypt(nullA);
            Connected = true;
            pHandler = new PacketHandler(this);
            pHandler.Initialize();

            pLoop = new PacketLoop(this, mSocket);
            pLoop.Start();
            Thread.Sleep(1000);
        }