学习笔记
6.3 select函数
1、
#include<sys/select.h>
#include<sys/time.h>
Int select(int maxfdp1,fd_set * readset, fd_set * writeset, fd_set * exceptset, const struct timeval * timeout);
2、所需输入数据结构
Struct timeval
{
Long tv_sec;
Long tv_usec;
}
3、所用到的宏
Void FD_ZERO(fd_set * fdset);
Void FD_SET(int fd, fd_set * fdset);
Void FD_CLR(int fd, fd_set * fdset);
Int FD_ISSET(int fd, fd_set * fdset);
6.6 shutdown函数
#include<sys/socket.h>
Int shutdown(int sockfd,int howto);
6.9 pselect函数
1、
#include<sys/select.h>
#include<signal.h>
#include<time.h>
Int pselect(int maxfdp1,fd_set * readset, fd_set * writeset, fd_set * exceptset, const struct timespec* timeout, const sigset_t * sigmask);
2、 所需输入的数据结构
Struct timespec
{
Time_t tv_sec;
Long tv_nsec;
}
6.10 poll函数
1、
#include<poll.h>
Int poll(struct pllfd * fdarray,unsigned long nfds,int timeout);
3、 所需输入的数据结构
Struct pollfd
{