Comments (2)
1、什么平台,什么组件?
2、完整demo代码
3、发不出去是程序卡住还是对方收不到,如果是后者检查一下send的getlasterror
from hp-socket.
1、什么平台,什么组件? 2、完整demo代码 3、发不出去是程序卡住还是对方收不到,如果是后者检查一下send的getlasterror
很抱歉到现在才回复 因为之前没有收到邮件
Win32, 版本是lateset
组件是CTcpServerPtr
这个问题目前还存在
getlasterror无有效信息
目前来说短暂延迟可以解决问题 也许是c++性能太强导致的???
BOOL CS_SendAllEx(ESTR& nData) {
static CONNID scArg[0x10000];
DWORD dwCount; BOOL bSafe; CONNID* sArg;
dwCount = CServer->GetConnectionCount();
if (dwCount == 0) {
DDS(einfunc "当前无用户[%s]", nData);
return TRUE;
}
bSafe = dwCount < _ARRAYSIZE(scArg); // Cookie Mode
sArg = bSafe ? scArg : (CONNID*)malloc(sizeof CONNID * dwCount);
if (sArg == nullptr) {
DDF(einfunc "没有足够的空间[%s]", nData.data());
return FALSE;
}
// 1.取出所有客户
CServer->GetAllConnectionIDs(sArg, dwCount);
while (dwCount--) {
CServer->Send(sArg[dwCount], nData, nData.lenth());
::Sleep(18); // 强制性延迟防止send太快而数据未发出 也许是BUG???
}
// 3. 释放申请的内存
if (!bSafe) ::free(scArg);
return TRUE;
}
from hp-socket.
Related Issues (20)
- 无法启动服务器。( The listener will not start.) HOT 12
- 求官方支持macos和ios HOT 2
- 建议封装一个websocket类 HOT 2
- UDP服务端运行一会后奔溃 客户端以非常快速度发送数据 HOT 9
- mint
- 能否加入zstd压缩库 HOT 3
- 6.0.1没发布?看日志记录有6.0.1 HOT 2
- 流式数据压缩 怎么用呀 HOT 4
- 作者是那个国家的? HOT 1
- 可以支持vcpkg? HOT 1
- 解压算法出错,解压数据不能正确处理 HOT 4
- HP_Create_BrotliCompressor 函数请求支持lambda表达式绑定 HOT 1
- 断线重连机制卡死 HOT 2
- 请问有没有类似sendmmsg和recvmmsg的支持,或者其他加速小包(payloa在32~64 Bytes)发送的功能呢 HOT 1
- 建议增加设置/获取 组件标识符功能, 为多个组件共用一个监听器提供便利 HOT 2
- 可以做个vcpkg的包吗? HOT 3
- Can i use customized client class in CTcpServer? HOT 2
- a
- C语言问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hp-socket.