#include #include #include #include #include int main() { trantor::Logger::setLogLevel(trantor::Logger::TRACE); struct hostent* he = gethostbyname("www.baidu.com"); struct in_addr addr; if (he && he->h_addrtype == AF_INET) { addr = *reinterpret_cast(he->h_addr); struct sockaddr_in ad; bzero(&ad, sizeof ad); ad.sin_family = AF_INET; ad.sin_addr=addr; trantor::InetAddress netaddr(ad); auto client=HttpClient::newHttpClient(netaddr.toIp(),80); auto req=HttpRequest::newHttpRequest(); req->setMethod(drogon::HttpRequest::kGet); req->setPath("/s"); req->setParameter("wd","weixin"); int count=0; for(int i=0;i<10;i++) client->sendRequest(req,[&](ReqResult result,const HttpResponse &response){ std::cout<<"receive response!"<