Exemple #1
0
        static bool Init()
        {
            bool                 result               = false;
            LPListener           listener             = null;
            ServerMessageHandler serverMessageHandler = null;

            serverMessageHandler = new ServerMessageHandler();
            if (LOG_ERROR(serverMessageHandler != null))
            {
                goto Exit0;
            }

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

            listener = LP.NetModule.CreateListener(IPAddress.Parse("127.0.0.1"), 7777, serverMessageHandler);
            if (LOG_ERROR(listener != null))
            {
                goto Exit0;
            }

            result = listener.Start();
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            return(true);

Exit0:
            return(false);
        }
Exemple #2
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);
        }
Exemple #3
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);
        }