Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用 Libcurl C++ 做了一个长轮询客户端
通过以下方式将超时设置为 30 秒:
curl_easy_setopt(longPollingHandle, CURLOPT_TIMEOUT, 30L);
操作超时后如何重新发出 HTTP get 请求?
谢谢
对于任何有兴趣的人。
我刚刚检查了 CURLcode 的状态。如果是 != 0 则重新发出请求。
if(res != 0) { cout << "Timeout : Repolling " << endl; continue; }
continue 返回到循环的开头,我再次发出 curl_easy_perform 。