When the readBin gives a 0-length result.  See the help file.
On Sun, 24 Aug 2003, Andy Jacobson wrote:
>         Is there an easy way of determining whether one has reached
>         the end-of-file when reading a connection?  I am reading a
>         binary file and I would like to know when the read fails.
-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595