This is a discussion on How to handle Potential Problems with select() within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi all, I have a problem I hope someone can help me with. If I make a call to ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi all, I have a problem I hope someone can help me with. If I make a call to select, and the operating system tells me that there is data to be read on one of my sockets, how do i handle the problem when select says there is data to be read but FD_ISSET reports no activity on any socket? Is it possible to some how reset select to not report that socket as ready for reading again? This is my problem. select returns saying there is data, but when I do an FD_ISSET to find out which socket is ready no sockets have info ready to be read. Is it possible to tell which fd select is reporting is ready, or can I reset select altogether? Please any help would be appreciated Steven H. |
| |||
| Despite all prevention efforts, sheadley@omiintl.com (sheadley) wrote in news:7fd5a68.0408250733.5024a8e3@posting.google.co m: > Hi all, > > I have a problem I hope someone can help me with. If I make a call to > select, and the operating system tells me that there is data to be > read on one of my sockets, how do i handle the problem when select > says there is data to be read but FD_ISSET reports no activity on any > socket? Is it possible to some how reset select to not report that > socket as ready for reading again? This is my problem. select returns > saying there is data, but when I do an FD_ISSET to find out which > socket is ready no sockets have info ready to be read. Is it possible > to tell which fd select is reporting is ready, or can I reset select > altogether? Please any help would be appreciated > > > Steven H. > I'm not in front of my AIX box at the moment, so I cannot verify this, but assuming select() is similar to the Linux & Windows implementations: Three independent sets of descriptors are watched. Those listed in readfds will be watched to see if characters become available for read- ing (more precisely, to see if a read will not block - in particular, a file descriptor is also ready on end-of-file), those in writefds will be watched to see if a write will not block, and those in exceptfds will be watched for exceptions. On exit, the sets are modified in place to indicate which descriptors actually changed status. According to that, shouldn't your list of sockets be modified in place by the function call to let you know know which fd(s) are considered ready to read? -- Slor |
| |||
| In article <7fd5a68.0408250733.5024a8e3@posting.google.com> , sheadley wrote: > I have a problem I hope someone can help me with. If I make a call to > select, and the operating system tells me that there is data to be > read on one of my sockets, how do i handle the problem when select > says there is data to be read but FD_ISSET reports no activity on any > socket? Is it possible to some how reset select to not report that > socket as ready for reading again? This is my problem. select returns > saying there is data, but when I do an FD_ISSET to find out which > socket is ready no sockets have info ready to be read. Is it possible > to tell which fd select is reporting is ready, or can I reset select > altogether? Please any help would be appreciated It's hard to draw any conclusions from your post, because the behavior you describe matches neither the industry standards specifications, nor the implementations of select() I have seen (yes, I have used select() on AIX as well, and it did not exhibit this behavior.) From your description it sounds like you used the return value of select() properly, but just to make sure: select() returns 0 on timeout, -1 on failure, and the number of ready descriptors on success. What value(s) are you getting exactly and how many sockets do you have? How frequently does this problem occur? Are you aware of the fact that an EOF condition is considered to be ``ready for reading'' as well (in which case FD_ISSET() should report activity though)? Have you initialized your descriptor set using FD_CLR() before you called select()? Is your program small enough to post it here, or could you take out the select() bits and use them to produce a minimal program that reproduces your problem? -- My real email address is ``nils<at>sipoc<dot>de'' |
| ||||
| In article <2p4gdsFgjppmU1@uni-berlin.de>, Nils Weller wrote: > Have you initialized your descriptor set using FD_CLR() before you ^^^^^^^^ Of course, I meant FD_ZERO(). -- My real email address is ``nils<at>sipoc<dot>de'' |