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}"); }
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}"); }