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