From 8b689e8e2ad28ac1cbbceb1ecbf0e6931ab46413 Mon Sep 17 00:00:00 2001 From: groot Date: Tue, 16 Apr 2019 16:25:14 +0800 Subject: [PATCH] client sucessfully connect to server Former-commit-id: 1e9186c606ae9ca46f9b2f57ccaeeb50b4cc6c3a --- cpp/src/server/ServiceWrapper.cpp | 2 +- cpp/test_client/src/ClientApp.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cpp/src/server/ServiceWrapper.cpp b/cpp/src/server/ServiceWrapper.cpp index c0c4293e..9bf047da 100644 --- a/cpp/src/server/ServiceWrapper.cpp +++ b/cpp/src/server/ServiceWrapper.cpp @@ -135,7 +135,7 @@ void ServiceWrapper::StartService() { s_server.reset(new TSimpleServer(processor, serverTransport, transportFactory, protocolFactory)); s_server->serve(); } else if(mode == "thread_pool") { - ::apache::thrift::stdcxx::shared_ptr threadManager(ThreadManager::newSimpleThreadManager(1)); + ::apache::thrift::stdcxx::shared_ptr threadManager(ThreadManager::newSimpleThreadManager()); ::apache::thrift::stdcxx::shared_ptr threadFactory(new PosixThreadFactory()); threadManager->threadFactory(threadFactory); threadManager->start(); diff --git a/cpp/test_client/src/ClientApp.cpp b/cpp/test_client/src/ClientApp.cpp index 78d5f1c9..fe9f368d 100644 --- a/cpp/test_client/src/ClientApp.cpp +++ b/cpp/test_client/src/ClientApp.cpp @@ -43,7 +43,7 @@ void ClientApp::Run(const std::string &config_file) { std::string mode = server_config.GetValue(server::CONFIG_SERVER_MODE, "thread_pool"); - ::apache::thrift::stdcxx::shared_ptr socket_ptr(new ::apache::thrift::transport::TSocket("localhost", 9090)); + ::apache::thrift::stdcxx::shared_ptr socket_ptr(new ::apache::thrift::transport::TSocket(address, port)); ::apache::thrift::stdcxx::shared_ptr transport_ptr(new TBufferedTransport(socket_ptr)); ::apache::thrift::stdcxx::shared_ptr protocol_ptr; if(protocol == "binary") { @@ -59,17 +59,17 @@ void ClientApp::Run(const std::string &config_file) { VecServiceClient client(protocol_ptr); try { client.dummy(); -// VecGroup group; -// group.id = "test_group"; -// group.dimension = 256; -// group.index_type = 0; -// client.add_group(group); + + VecGroup group; + group.id = "test_group"; + group.dimension = 256; + group.index_type = 0; + client.add_group(group); } catch (apache::thrift::TException& ex) { printf("%s", ex.what()); } transport_ptr->close(); - server::CommonUtil::PrintInfo("test_client exit..."); } } -- GitLab