如果我使用带有select()调用的非阻塞套接字而不是使用带有select()调用的阻塞套接字,我的程序将如何在行为上有所不同?
select
轮询的行为不会有所不同,只有接收/发送功能在阻塞/非阻塞套接字之间会有所不同。
select()
won't behave differently. read()
, write()
, accept()
and other I/O functions will -- they will never block on non-blocking sockets, while they might block even if select()
tells they would not, although this is somewhat rare.
https://stackoverflow.com/a/5352634/259543
Not sure whether this behavior is allowed by POSIX, though.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.