#include #include #include #include #include #include "ivservice.h" void ProcReq(std::shared_ptr pstr_req,const int nreqsize,std::shared_ptr & pstr_res,int & nressize) { pstr_res = std::shared_ptr(new char[100]); nressize = 100; } void ProcAsync(std::shared_ptr & pstr_res,int & ndatasize,int nres) { if(nres == 0) { std::cout<<"extend time."< pstr_req = std::shared_ptr(new char[1000000]); std::shared_ptr pstr_res; int nressize = 0; int nsendsize = 100; while(nsendsize < 1000000) { std::this_thread::sleep_for(std::chrono::milliseconds(1000)); nsendsize = nsendsize * 1; if(nsendsize >= 1000000)break; std::cout< pstr_req = std::shared_ptr(new char[1000000]); std::shared_ptr pstr_res; int nressize = 0; if(iv::service::Client::HAVE_RES == xclient.SendRequest(pstr_req,100,pstr_res,nressize)) { std::cout<<"Res Time: "<= 1000000)break; std::cout<<"Send Time : "< tp =std::chrono::system_clock::now(); qint64 xtime1 = std::chrono::system_clock::now().time_since_epoch().count(); qint64 xtime2 = std::chrono::system_clock::now().time_since_epoch().count(); qint64 xtd = xtime2 - xtime1; // iv::service::Server xserver("helloa",ProcReq); // std::this_thread::sleep_for(std::chrono::milliseconds(300)); // std::thread * pthread_a = new std::thread(threadclientai,1); // std::thread * pthread_b = new std::thread(threadclientai,2); iv::service::Client xaync("async"); std::shared_ptr pstr_async = std::shared_ptr(new char[1000]); xaync.AsyncSendRequest(pstr_async,100,ProcAsync); std::this_thread::sleep_for(std::chrono::milliseconds(10000)); iv::service::Server xserver("async",ProcReq); // std::thread * pthread = new std::thread(threadclient); // int i; // for(i=0;i<100;i++) // { // std::this_thread::sleep_for(std::chrono::milliseconds(3000)); // pthread = new std::thread(threadclient); // } return a.exec(); }