Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What data structure is behind FD_SET and FD_ISSET when working with sockets in c?

Tags:

c

select

sockets

What data structure is behind FD_SET and FD_ISSET macro when working with sockets?

like image 762
FlinkmanSV Avatar asked Dec 02 '22 08:12

FlinkmanSV


1 Answers

Prototypes:

void FD_SET(int fd, fd_set* fdset);
int FD_ISSET(int fd, fd_set* fdset);

From sys/select.h

typedef struct fd_set {
  u_int  fd_count;
  SOCKET fd_array[FD_SETSIZE];
} fd_set;
like image 135
user44556 Avatar answered Dec 04 '22 20:12

user44556