标签:编程入门 clu thread 接收 一个 事件 指定 read 网络编程
#include <poll.h>
int poll(struct pollfd fd[], nfds_t nfds, int timeout);
参数:
1)第一个参数:一个结构数组,struct pollfd结构如下:
struct pollfd{
int fd; //文件描述符
short events; //请求的事件
short revents; //返回的事件
};
2)第二个参数nfds:要监视的描述符的数目。
3)最后一个参数timeout:是一个用毫秒表示的时间,是指定poll在返回前没有接收事件时应该等待的时间。如果 它的值为-1,poll就永远都不会超时。如果整数值为32个比特,那么最大的超时周期大约是30分钟。
标签:编程入门 clu thread 接收 一个 事件 指定 read 网络编程
原文地址:https://www.cnblogs.com/aiqingyi/p/11252110.html