@
iMouseWu 我认为你说的这种是 I/O 多路复用搭配 non-blocking 的问题,
https://www.zhihu.com/question/37271342 ,里面的回答是这样的:
Under Linux, select() may report a socket file descriptor as "ready for reading", while nevertheless a subsequent read blocks. This could for example happen when
data has arrived but upon examination has wrong checksum and is discarded. There may be other circumstances in which a file descriptor is spuriously reported as
ready. Thus it may be safer to use O_NONBLOCK on sockets that should not block.
里面说的是 select 和 read , select 和 read 是两个独立的系统调用,当 select 可读的时候, read 不一定可读。我没有查 accept 的 man 手册,但是我觉得 accept 也是这样的。(我感觉 accept 这句话有问题)
最后结果就是 I/O 多路复用搭配 non-blocking 。至于你说的数据从内核缓冲区 copy 到用户缓冲区,这个我不太了解。