当前位置: 技术问答>linux和unix
select函数中的可读,可写表示什么含义
来源: 互联网 发布时间:2017-01-09
本文导语: 如题 | A socket is ready for writing if any of the following four conditions is true: The number of bytes of available space in the socket send buffer is greater than or equal to the current size of the low-water...
如题
|
A socket is ready for writing if any of the following four conditions is true:
The number of bytes of available space in the socket send buffer is greater than or equal to the current size of the low-water mark for the socket send buffer and either: (i) the socket is connected, or (ii) the socket does not require a connection (e.g., UDP). This means that if we set the socket to nonblocking (Chapter 16), a write operation will not block and will return a positive value (e.g., the number of bytes accepted by the transport layer). We can set this low-water mark using the SO_SNDLOWAT socket option. This low-water mark normally defaults to 2048 for TCP and UDP sockets.
The number of bytes of available space in the socket send buffer is greater than or equal to the current size of the low-water mark for the socket send buffer and either: (i) the socket is connected, or (ii) the socket does not require a connection (e.g., UDP). This means that if we set the socket to nonblocking (Chapter 16), a write operation will not block and will return a positive value (e.g., the number of bytes accepted by the transport layer). We can set this low-water mark using the SO_SNDLOWAT socket option. This low-water mark normally defaults to 2048 for TCP and UDP sockets.
|
就是用来socket中是否有可执行写动作的fd