Multiple fds in select()

Hi

I want to read messages from multiple interfaces using one select() statement. Does anybody knows if I can specify multiple fds in the *readfds parameter? If yes, what's the max num of fds?
Something like the following:

fd_set descrSet = {0};
int retVal;
MyStructS *msg = NULL;

while{
FD_ZERO(&descrSet);
FD_SET(Intf1SockNum, &descrSet);
FD_SET(Intf2SockNum, &descrSet);
FD_SET(Intf3SockNum, &descrSet);
.
.
FD_SET(IntfnSockNum, &descrSet);

/* wait for msg / timeout */
retVal = select(FD_SETSIZE, &descrSet, NULL, NULL, &timeout);

/*check what happened /
switch (retVal){
case -1:
/
handle error */
break;

case 0:
/* timeout before msg arrived */
break;

default:
if (FD_ISSET(Intf1SockNum, &descrSet)){
retVal = ReadMsgfromIntf1(&msg);
/* handle msg rxed*/
} /* if /
if (FD_ISSET(Intf2SockNum, &descrSet)){
retVal = ReadMsgfromIntf2(&msg);
/
handle msg rxed*/
} /* if /
.
.
if (FD_ISSET(IntfnSockNum, &descrSet)){
retVal = ReadMsgfromIntf3(&msg);
/
handle msg rxed*/
} /* if /
} /
switch*/
} /* while */

Thanx

Your limit will depend on how many fd's you can have open at once.

By default, those macros are setup to handle onle 2048 fd's. If you need more fd's than than, then you must define FD_SETSIZE to be the number that you need. Put this "define" above the the "include" which is bringing in the FD macros. That include file will see your definition and will respect it.