bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: select() for read a regular file


From: tovis
Subject: Re: select() for read a regular file
Date: Thu, 13 Apr 2006 19:32:58 +0200 (CEST)
User-agent: SquirrelMail/1.4.4

> "tovis" <address@hidden> wrote:
>> Does the select() working for reading a regular file?
>> At last I have built a small example code and I get the result that file
>> is always could be read, event if nothing to read (file siez is zero).
>
> That's normal.  You'll also see pipes and sockets as readable when
> they're at EOF.  select() doesn't quite tell you when there is data to
> be read - it tells you when read() would return quickly without
> blocking.  That will happen if there is data to be read, or if the
> descriptor is at EOF.
>
>
> paul
>
>

Strange! I have used select() on UDP socket (multicast also) and does not
realize that is it signalled if nothing to receive! - if I receive zero
bytes from a signalled socket I treated it as an error and log it - no
such an error in my log files (for years?).
OK socket, stdin are special files, what to do with regular files?
Huh! - should I polling the file state and check if size is growing, ss I
have seen in "tail" source code? It seem to be horrible! - but, of course
it is working.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]