# /* in_bread.c */ /* EMACS_MODES: c !fill */ /* Internet protocol layer for the MIT network system. The following * routines are included: * in_bread Blocking read for internet packets * * Note that use of this package requires the use of the standard I/O * library. */ #include #include #include #include #include in_bread (fd, buf, len, timeout) /* Blocking read for internet packet, with a timeout on the read. * Wait up to timeout seconds for an internet packet to arrive on * the specified internet connection, then read it into * the specified buffer. If a packet is presently available the routine * will read it and return immediately. Returns the length of the * received packet in bytes, or 0 if the timeout expires. * * Arguments: */ int fd; /* file descriptor for this conn */ caddr_t buf; /* buffer for received data */ int len; /* buffer size in bytes */ int timeout; /* time to wait before returning */ { if (in_wait (timeout)) return (in_read (fd, buf, len)); else return (0); }