Ejemplo n.º 1
0
        public SocketServer(int port) : base(port)
        {
            CallFuncThriftEx <T> handler = new CallFuncThriftEx <T>();

            CallFuncThrift.Processor processor       = new CallFuncThrift.Processor(handler);
            TServerTransport         serverTransport = new TServerSocket(port);

            server = new TThreadPoolServer(processor, serverTransport);
            Logger.log("创建ThriftServer", $"端口号:{port}");
        }
Ejemplo n.º 2
0
        public HTTPServer(int port) : base(port)
        {
            CallFuncThriftEx <T> handler = new CallFuncThriftEx <T>();

            CallFuncThrift.Processor processor = new CallFuncThrift.Processor(handler);


            string serviceUrl = "http://localhost:99/";

            TProtocolFactory protocolFactory = new TJSONProtocol.Factory();
            THttpHandler     httpServer      = new THttpHandler(processor, protocolFactory);

            HttpListener httpListener = new HttpListener();

            httpListener.Prefixes.Add(serviceUrl);
            httpListener.Start();

            //Logger.log("创建ThriftServer", $"端口号:{port}");
        }