首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

初学者急问,小弟我的recv()为什么只能接收1448个字符

2012-03-03 
菜鸟急问,我的recv()为什么只能接收1448个字符?为什么我的recv()为什么只能接收1448个字符?[解决办法]自己

菜鸟急问,我的recv()为什么只能接收1448个字符?
为什么我的recv()为什么只能接收1448个字符?

[解决办法]
自己写一个函数readn 不就行了?
int readn(int fd, void *vptr, size_t n)
{
size_t nleft;
ssize_t nread;
char *ptr;
 
ptr = (char *)vptr;
nleft = n;
while (nleft > 0) {
if ( (nread = read(fd, ptr, nleft)) < 0) {
if (errno == EINTR)
nread = 0;
else
return(-1);
} else if (nread == 0)
break;


nleft -= nread;
ptr += nread;
}
return(n - nleft);
}

热点排行
Bad Request.