阅读背景:

读取(3)“调用的长度大于目标缓冲区的大小”

来源:互联网 

With the following code:

用下面的代码:

#define MIN(a,b) ({ typeof (a) _a = (a); typeof (b) _b = (b); _a < _b ? _a : _b; })
...
size_t const recvBufLength = 50*1024*1024;
char * const recvBuf = malloc(recvBufLength);
...
while ((r = read(sockfd, recvBuf, MIN(recvLength-received, recvBufLength))) > 0) {
    ...
}
#define MI



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: