Example #1
0
        public static bool Test_ClientMessageHandler()
        {
            bool                 result               = false;
            LPConnector          connector            = null;
            ClientMessageHandler clientMessageHandler = null;

            clientMessageHandler = new ClientMessageHandler();
            if (LOG_ERROR(clientMessageHandler != null))
            {
                goto Exit0;
            }

            result = LP.Init(EPlatform.Pc, true, clientMessageHandler);
            if (ERROR(result))
            {
                goto Exit0;
            }

            connector = LP.NetModule.CreateConnector(clientMessageHandler);
            if (LOG_ERROR(connector != null))
            {
                goto Exit0;
            }

            result = connector.Start("127.0.0.1", 7777);
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

Exit0:
            return(true);
        }
Example #2
0
        public static bool Test_GTMessageHandler()
        {
            bool             result           = false;
            LPConnector      connector        = null;
            LPMessageHandler gtMessageHandler = null;
            LPPacketParser   gtPacketParser   = null;

            gtMessageHandler = new LPMessageHandler();
            if (LOG_ERROR(gtMessageHandler != null))
            {
                goto Exit0;
            }

            gtPacketParser = new LPPacketParser();
            if (LOG_ERROR(gtPacketParser != null))
            {
                goto Exit0;
            }

            result = gtMessageHandler.Init();
            if (ERROR(result))
            {
                goto Exit0;
            }

            result = LP.Init(EPlatform.Pc, true, gtMessageHandler);
            if (ERROR(result))
            {
                goto Exit0;
            }

            connector = LP.NetModule.CreateConnector(gtPacketParser);
            if (LOG_ERROR(connector != null))
            {
                goto Exit0;
            }

            result = connector.Start("127.0.0.1", 6002);
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

Exit0:
            return(true);
        }