Exemple #1
0
        static void Main(string[] args)
        {
            ProtoGLSMessage.ReqUpdateServerInfoMessage glmessage = new ProtoGLSMessage.ReqUpdateServerInfoMessage();
            glmessage.Connects = 5;
            glmessage.ServerID = 1;
            glmessage.ZoneID   = 1;
            byte[] buff = MessageHelper.MessageSerialize(glmessage);
            Console.WriteLine(buff.Length);

            HttpServer httpserver = NettyPool.AddHttpBind("127.0.0.1", 9527, 2);

            httpserver.AddHandler("*", new ActionHttpHandler((session) =>
            {
            }));

            httpserver.AddHandler("login", new ActionHttpHandler((session) =>
            {
                session.AddContent("<html><body>login holle !</body></html>");
            }));

            httpserver.Start();

            string msg = HttpClient.SendUrl("http://127.0.0.1:9527", "GET");

            Console.WriteLine(msg);
            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            HttpServer httpserver = NettyPool.AddHttpBind("127.0.0.1", 9527, 2);

            httpserver.AddHandler("*", new ActionHttpHandler((session) =>
            {
                session.AddContent("<html><body>webapi!</body></html>");
            }));

            httpserver.AddHandler("login", new ActionHttpHandler((session) =>
            {
                session.AddContent("<html><body>login holle !</body></html>");
            }));

            httpserver.Start();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            NettyPool.SessionHandler       = new Handler();
            NettyPool.ClientSessionHandler = new ClientHandler();

            NettyPool.AddTcpBind("127.0.0.1", 8001);

            clientA = new NettyClient(port: 8001);
            clientA.Connect();

            clientB = new NettyClient(port: 8001);
            clientB.Connect();

            System.Threading.Thread.Sleep(1000);

            log.Error("数量 " + NettyPool.Sessions.Count);

            sendtask = new SendTask();

            ThreadPool.AddGlobTimerTask(sendtask);

            Console.ReadLine();
        }