Click to See Complete Forum and Search --> : Linux Serial Programming.


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.

Stuka
10-10-2003, 06:19 PM
You'd be better off using select() or poll(), so you could read when the fd was ready.