![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| retrieved multiple lines on multiple places in a file | dala | Shell Programming and Scripting | 8 | 03-14-2008 03:28 PM |
| Awk - select from a list | simha77777 | UNIX for Dummies Questions & Answers | 14 | 02-07-2008 12:42 PM |
| SED scripting select | i_am_a_robot | Shell Programming and Scripting | 6 | 05-02-2007 07:00 AM |
| Dynamic select with multiple word menu items | domivv | Shell Programming and Scripting | 5 | 07-22-2004 09:52 AM |
| how to select a value randomly | norsk hedensk | Shell Programming and Scripting | 1 | 10-28-2003 05:39 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|