服务器代码:
TMultiplexedProcessor processor = new TMultiplexedProcessor();
processor.registerProcessor(
"AddService",
new AddService.Processor(new AddHandler()));
processor.registerProcessor(
"MultiplyService",
new MultiplyService.Processor(new MultiplyHandler()));
TServerTransport serverTransport = new TServerSocket(7911);
TSimpleServer server = new TSimpleServer(new TSimpleServer.Args(serverTransport).
processor(processor));
System.out.println("Starting server on port 7911 ...");
server.serve();
客户代码:
TFramedTransport transport;
transport = new TFramedTransport(new TSocket("localhost", 7911));
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
System.out.println("1");
TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "AddService");
AddService.Client service = new AddService.Client(mp);
System.out.println("2");
TMultiplexedProtocol mp2 = new TMultiplexedProtocol(protocol, "MultiplyService");
MultiplyService.Client service2 = new MultiplyService.Client(mp2);
System.out.println("3");
System.out.println(service.add(2,2));
System.out.println(service2.multiply(2000,200));
但是当我运行服务器(侦听端口 7911)和客户端时,客户端不会处理对加法/乘法函数的最后两次调用。
我可以调试参数已发送到服务器,但服务器无法处理它们。
关于我缺少什么的任何指示?