23,125
社区成员
发帖
与我相关
我的任务
分享
struct timeval timeout1={0,3}; //select等待3毫秒,3毫秒轮询,要非阻塞就置0
FD_ZERO(&rd);
FD_SET(fd_global, &rd);
if(FD_ISSET(fd_global, &rd))
{
if(select(fd_global+1, &rd, NULL, NULL, &timeout1) < 0)
{
perror("select error\n");
}
else
{
while((nRead = ev_read(fd_global,recv_buf,READ_SIZE)) > 0)
{
COUNTER_IN = nRead;
printf("nRead = %d\n", nRead);
int recv_index, index = 0;
for(recv_index=0;recv_index<nRead;recv_index++,index++)//存储每次从缓冲区读取得数据
{
DATA_IN[index]=recv_buf[recv_index];
//printf("m@DATA_IN[%d]=%x\n",index,DATA_IN[index]);
}
}
}
}