int res=::send(con->m_socket,dp->m_buf,dp->m_lenght,0); if(res>0) { theDebugData.mSendBufferLen+=dp->m_lenght; } else if(res<0) theDebugData.mSendErrorCount++;
我要发送很多个对象,如果打成一个包,数据太多的时候,就有可能导致内存分配失败。 所以我就拆分成好几组分别打包发送: 在一个for循环中,不断调用send发送数据,但是后面的数据总是发送失败。成功发送17次左右(2.5万个字节左右),后面的就失败了,send返回负数 请问,这是为什么?有什么办法可以解决? 循环体的代码如下: int res=::send(con->m_socket,dp->m_buf,dp->m_lenght,0); if(res>0) { theDebugData.mSendBufferLen+=dp->m_lenght; } else if(res<0) theDebugData.mSendErrorCount++;
18,363
社区成员
64,187
社区内容
加载中
试试用AI创作助手写篇文章吧