Home > Back-end >  The problem of epoll level trigger read data
The problem of epoll level trigger read data

Time:10-10

I use epoll wait for TCP flow can be read event, the event came after read the message,

Will not appear this kind of circumstance:
1, the client to send A 6 KB of data, the length of the head with data information
2, but other clients also sent N bytes of data, this time server TCP kernel buffer can only 60 byte of data caching, and then contact the client sends A 60 flow control byte,
3, after the data to the server, signals to the socket (non-blocking) readable epoll_wait return
4, I use the read function reads data acquisition header information, learned that the length of the data reuse readn (sock, buf, n - head);
5, read after 60 bytes of data return 1, errno is set to EAGAIN
(remaining TCP flow did not reach should be the same?)

Now the problem is whether I want to store the current socket and record of the number of bytes read, and then again after returning to produce readable strcat to read data,
I see online epoll examples are only a read is completed
  • Related