We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我新建了个一些tcpclient 向这个demo的tcpehcosession 发送消息,然后服务器在将消息返回,但是我发现每次收到的消息都少,通过网卡抓包 消息是回到了client的 不知道什么原因没上来,另外 这个时候我control+c tcpehcosession,这面客户端收感觉丢的消息这个时候就都上来了,请帮我看看
附上client的代码 tcpechosession 就负责回消息,啥都不干
int main() { // 设置日志系统 Logger::Instance().add(std::make_shared()); Logger::Instance().add(std::make_shared()); Logger::Instance().setWriter(std::make_shared()); for (int i = 0; i < 200; i++) { TestClient::Ptr client(new TestClient());//必须使用智能指针 client->startConnect("192.168.1.189", 40996);//连接服务器 testmap.emplace(i, client); } sleep(30); for (auto it = testmap.begin(); it != testmap.end(); it++) { it->second->send("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"); }
The text was updated successfully, but these errors were encountered:
Windows 环境 #define FD_SETSIZE 1024 多加了这句话 现在勉强能到1000个tcpclient了并且不丢包
Sorry, something went wrong.
windows下用的select ,每个select实例最多支持1024个fd。 如果你在windows下,这个1000个客户端都分配到一个select线程实例了,那么可能会存在添加select监听失败,会有以下警告:
attachEvent failed
具体代码为: https://github.com/xiongziliang/ZLToolKit/blob/master/src/Network/Socket.cpp#L527
No branches or pull requests
我新建了个一些tcpclient 向这个demo的tcpehcosession 发送消息,然后服务器在将消息返回,但是我发现每次收到的消息都少,通过网卡抓包 消息是回到了client的 不知道什么原因没上来,另外 这个时候我control+c tcpehcosession,这面客户端收感觉丢的消息这个时候就都上来了,请帮我看看
附上client的代码 tcpechosession 就负责回消息,啥都不干
int main() {
// 设置日志系统
Logger::Instance().add(std::make_shared());
Logger::Instance().add(std::make_shared());
Logger::Instance().setWriter(std::make_shared());
for (int i = 0; i < 200; i++)
{
TestClient::Ptr client(new TestClient());//必须使用智能指针
client->startConnect("192.168.1.189", 40996);//连接服务器
testmap.emplace(i, client);
}
sleep(30);
for (auto it = testmap.begin(); it != testmap.end(); it++)
{
it->second->send("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
}
The text was updated successfully, but these errors were encountered: