ka@hou3c.UUCP (Kenneth Almquist) (07/08/84)
I have a pair of programs that talk over an asynchronous link. The protocal requires a routine to read n bytes off the link. Since I didn't want to read a character at a time, I wrote code that looked like: ttymodes.c_cc[VMIN] = n; ioctl(fd, TCSETA, &ttymodes); count = read(fd, buf, n); The problem with this code is that resetting VMIN does not affect the value of delct. Thus if n characters have already been received when this code is executed, the read will roadblock waiting for additional characters unless delct is already set. It will not be if the previous value of VMIN was greater than n. I haven't tried to fix this yet. It is possible to work around it by setting VMIN to a large value and VTIME to 1. Unfortunately that adds a delay of about 0.15 second between the time the end of a message is received and the time the message is made available to a program. My belief is that I should be able to set VMIN to a large value, and then have read return when the number of characters requested by the read is available. Kenneth Almquist