Linux, C, epoll(), read() data incompleted?

回眸只為那壹抹淺笑 提交于 2019-12-02 11:45:12
 event.events = EPOLLIN | EPOLLET;

You are doing edge triggered polling. Which means your last read is probably not reading all the available data. It stops after reading 64k data, even if there is more data available. But the poll will not trigger again due to the edge trigger. Suggest removing EPOLLET.

        break;  //I do received 2 errors of Try Again. How to try again?

By going back to your epoll loop.

        data: 60734  //??? why I am not able to read all 65536 bytes?

Because they hadn't been received yet.

I think you may miss the big picture on how you do non-blocking I/O with epoll.

  1. epoll tells you when there's data.
  2. You read as much as you can at that time.
  3. You go back to step 1.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!