예제 #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();
        }
예제 #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();
        }