更新 src/Netra.cpp
This commit is contained in:
@@ -171,6 +171,20 @@ namespace QCL
|
|||||||
return std::string(buffer, bytesReceived);
|
return std::string(buffer, bytesReceived);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TcpServer::removeClient(int clientSock)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(clientsMutex_);
|
||||||
|
for (auto it = clientSockets_.begin(); it != clientSockets_.end(); ++it)
|
||||||
|
{
|
||||||
|
if (*it == clientSock)
|
||||||
|
{
|
||||||
|
close(*it);
|
||||||
|
clientSockets_.erase(it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 获取当前所有客户端Socket副本(线程安全)
|
* @brief 获取当前所有客户端Socket副本(线程安全)
|
||||||
* @return 包含所有客户端socket的vector副本
|
* @return 包含所有客户端socket的vector副本
|
||||||
|
|||||||
Reference in New Issue
Block a user