Пример #1
0
        public void EmulateClient(string szName, string szPassword, string szIPAddress = "127.0.0.1", int nPort = 4500)
        {
            m_cManager = new TCPManager( 1, 2048 * 300 );

            Config.ConfigNet config = new Config.ConfigNet();
            config.ListenIp = IPAddress.Parse( szIPAddress );
            config.Port = nPort;

            m_cAuthEmulator = new XClientAuthEmulator( m_cManager, config, szName, szPassword, this );
        }
Пример #2
0
        public XClientGameEmulator(Config.ConfigNet conf, TCPManager man, XChat.XClientEmulator pBase, string pAccount, PacketOut pOut)
        {
            m_szAccount = pAccount;
            m_cGameConnection = new TCPConnection( man, null, this, conf );
            try {
                m_cGameConnection.Start();
                m_cGameConnection.SendTCP(CreateVersionPacket());
                m_cGameConnection.SendTCP( pOut );

            }
            catch {
                XLog.Log( "Can't connect to Game Server!" );
            }
        }
Пример #3
0
        public XClientAuthEmulator(TCPManager man, Config.ConfigNet conf, string pAccount, string pPassword, XChat.XClientEmulator cBase)
        {
            m_szName = pAccount;
            m_szPassword = pPassword;
            m_cClientBase = cBase;

            try {
                m_cAuthConnection = new TCPConnection( man, null, this, conf );
                m_cAuthConnection.Start();
                m_cAuthConnection.SendTCP( this.CreateVersionPacket() );
                m_cAuthConnection.SendTCP( this.CreateAESPacket() );
            }
            catch {
                XLog.Log( "Can't connect to Authentication Server!" );
            }
        }
Пример #4
0
        public TCPConnection(TCPManager iocp, Socket socket, INetworkHandler handler, Config.ConfigNet config)
        {
            m_config = config;
            m_iocp = iocp;
            m_networkHandler = handler;
            m_socket = socket;
            if (m_socket == null)
            {
                InitOutgoingSocket();
            }

            if (config.Encrypted)
            {
                m_encoding = new XRC4Cipher();
                m_decoding = new XRC4Cipher();
            }
            else
            {
                m_encoding = new XCipher();
                m_decoding = new XCipher();
            }
            m_encoding.SetKey("}h79q~B%al;k'y $E");
            m_decoding.SetKey("}h79q~B%al;k'y $E");

            m_readEventArgs = m_iocp.AcquireAsyncEvent();
            m_readEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(IO_Completed);
            m_readEventArgs.UserToken = this;

            m_writeEventArgs = m_iocp.AcquireAsyncEvent();
            m_writeEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(IO_Completed);
            m_writeEventArgs.UserToken = this;

            m_readEventArgs.AcceptSocket = m_socket;
            m_writeEventArgs.AcceptSocket = m_socket;
        }
Пример #5
0
 public TCPListener(TCPManager iocp, INetworkHandler handler, Config.ConfigNet config)
 {
     m_iocp = iocp;
     m_config = config;
     m_networkHandler = handler;
 }