提交 8b689e8e 编写于 作者: G groot 提交者: xj.lin

client sucessfully connect to server


Former-commit-id: 1e9186c606ae9ca46f9b2f57ccaeeb50b4cc6c3a
上级 1b9aeb89
...@@ -135,7 +135,7 @@ void ServiceWrapper::StartService() { ...@@ -135,7 +135,7 @@ void ServiceWrapper::StartService() {
s_server.reset(new TSimpleServer(processor, serverTransport, transportFactory, protocolFactory)); s_server.reset(new TSimpleServer(processor, serverTransport, transportFactory, protocolFactory));
s_server->serve(); s_server->serve();
} else if(mode == "thread_pool") { } else if(mode == "thread_pool") {
::apache::thrift::stdcxx::shared_ptr<ThreadManager> threadManager(ThreadManager::newSimpleThreadManager(1)); ::apache::thrift::stdcxx::shared_ptr<ThreadManager> threadManager(ThreadManager::newSimpleThreadManager());
::apache::thrift::stdcxx::shared_ptr<PosixThreadFactory> threadFactory(new PosixThreadFactory()); ::apache::thrift::stdcxx::shared_ptr<PosixThreadFactory> threadFactory(new PosixThreadFactory());
threadManager->threadFactory(threadFactory); threadManager->threadFactory(threadFactory);
threadManager->start(); threadManager->start();
......
...@@ -43,7 +43,7 @@ void ClientApp::Run(const std::string &config_file) { ...@@ -43,7 +43,7 @@ void ClientApp::Run(const std::string &config_file) {
std::string mode = server_config.GetValue(server::CONFIG_SERVER_MODE, "thread_pool"); std::string mode = server_config.GetValue(server::CONFIG_SERVER_MODE, "thread_pool");
::apache::thrift::stdcxx::shared_ptr<TSocket> socket_ptr(new ::apache::thrift::transport::TSocket("localhost", 9090)); ::apache::thrift::stdcxx::shared_ptr<TSocket> socket_ptr(new ::apache::thrift::transport::TSocket(address, port));
::apache::thrift::stdcxx::shared_ptr<TTransport> transport_ptr(new TBufferedTransport(socket_ptr)); ::apache::thrift::stdcxx::shared_ptr<TTransport> transport_ptr(new TBufferedTransport(socket_ptr));
::apache::thrift::stdcxx::shared_ptr<TProtocol> protocol_ptr; ::apache::thrift::stdcxx::shared_ptr<TProtocol> protocol_ptr;
if(protocol == "binary") { if(protocol == "binary") {
...@@ -59,17 +59,17 @@ void ClientApp::Run(const std::string &config_file) { ...@@ -59,17 +59,17 @@ void ClientApp::Run(const std::string &config_file) {
VecServiceClient client(protocol_ptr); VecServiceClient client(protocol_ptr);
try { try {
client.dummy(); client.dummy();
// VecGroup group;
// group.id = "test_group"; VecGroup group;
// group.dimension = 256; group.id = "test_group";
// group.index_type = 0; group.dimension = 256;
// client.add_group(group); group.index_type = 0;
client.add_group(group);
} catch (apache::thrift::TException& ex) { } catch (apache::thrift::TException& ex) {
printf("%s", ex.what()); printf("%s", ex.what());
} }
transport_ptr->close(); transport_ptr->close();
server::CommonUtil::PrintInfo("test_client exit...");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册