Cover V07, I03
Article
Listing 1
Listing 2

mar98.tar


Listing 1: Implementation of timeout periods

while (YES) { /* loop forever - return on expected reply or a timeout */
/* read a single character from the communication port */
if ((bytes = read (fpPort, &c, 1)) == -1) {
printf ("port read failure - %s\n", strerror (errno));
exit (1);
}
if (bytes == 0) { /* timeout */
if (++tries == seconds)
return (TIMEOUT);
}
else if (bytes > 0) { /* successfully read a character */
...

/* End of File */