我使用 c++11 线程库和套接字。我为每个套接字创建线程。
void connect_server(...)
{
//here socket (stream client) stuff with connecting, receiving and sending data
}
int main()
{
//...
for (...)
container.push_back(std::thread(connect_server, params));
for (...)
thread.join();
//...
}
如何检查连接是否超时?