I may be wrong, but does having a timeout of 0 for the select
call makes sense? I would try to increase the timeout value.
A:
Martin Cote
2009-06-17 14:40:34
Doesn't change anything to increase it (tried up to 500 usecs)
2009-06-17 14:56:01
A:
I remember there being a lot of argument about the semantics and operation of select() and a couple of replacements for it. You might look at those.
How is the stream you're reading being created/opened? Is it a buffered stream? Perhaps you get nothing because it's not been written to the stream until the writing process flushes it?
The other thing you might try is putting it on a thread with blocking I/O instead of polling.
Good luck with it
Jay
2009-06-17 15:23:58
A:
is the below inside the while loop, if not it should be.
FD_ZERO ( &fds );
FD_SET ( 0, &fds );
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
if the answer for my first question is yes, then please try this timeout
tv.tv_sec = 0;
tv.tv_usec = 1;
if the above doest work, try this
while(fgets(buf, sizeof ( buf ) - 1, stdin) !=NULL) { }
Warrior
2009-06-17 17:38:43