gommo
10-07-2003, 11:32 PM
Hi,
I'd like to setup my serial's read command so it blocks on a read from the serial port but only for a small amount of time.
I know that by setting
fcntl( fd, F_SETFL, FNDELAY );
then my read() calls will not block at all, and when I set
fnctl( fd, F_SETFL, 0 );
they block indefinitly.
Is there are way to make them block for say a number of milliseconds??
Thankyou
(Currently I have them not blocking and then I sleep for a little then loop through that a few times, but I'd like to see if you can set read to do this for you.
I'd like to setup my serial's read command so it blocks on a read from the serial port but only for a small amount of time.
I know that by setting
fcntl( fd, F_SETFL, FNDELAY );
then my read() calls will not block at all, and when I set
fnctl( fd, F_SETFL, 0 );
they block indefinitly.
Is there are way to make them block for say a number of milliseconds??
Thankyou
(Currently I have them not blocking and then I sleep for a little then loop through that a few times, but I'd like to see if you can set read to do this for you.