|
我的程序中有这样的一段代码
if(select(thread_sock + 1, &rfdset, NULL, NULL, &tv ) >0)
{
if((recv_len=recv(thread_sock,buffer,1024,MSG_WAITALL))<1)
{
g_print("Can not receive data from server,abort%d",thread_task->slice_num);
close(thread_sock);
if(thread_task->detail->slice_info[thread_task->slice_num].trys<=30)
{ sleep(2);
http_downloader(thread_task);
thread_task->detail->slice_info[thread_task->slice_num].write_len=0;
return ;
}
else
{ thread_task->detail->slice_info[thread_task->slice_num].failed=TRUE;
thread_task->detail->task_finished=FALSE;
thread_task->detail->slice_info[thread_task->slice_num].trys=0;
g_print("退出了");
return ;
}
}//if(recvlen)
}//if(select)
我的问题是为什么select返回值大于0,但是在recv的时候却收不到数据呢? |
|