delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/05/08/17:21:41

From: newsham AT lava DOT net (Tim Newsham)
Subject: socket read() bug
8 May 1998 17:21:41 -0700 :
Message-ID: <m0yXxGM-00119ZC.cygnus.cygwin32.developers@malasada.lava.net>
Mime-Version: 1.0
To: cygwin32-developers AT cygnus DOT com

Hi,

   I stumbled across another socket bug.  This time I don't have
a test program to reproduce it yet, but I have a program in which
it regularly occurs.  The problem -- sometimes a read() on a socket
will return 0 when EOF has not yet been reached.  (I have some
recv/read/recvfrom patches applied,  I am HOPING these arent the
cause of the problem,  if they are, then the problem may be elsewhere
in select() or FIONREAD for example).

So this is what is happening,  read() on a socket is occasionally
returning zero.  If I set a breakpoint to the point right after
this occurs,  and I do a "print read(fd, buf, 1)" it properly
reads the next char.  So, it looks like winsock incorrectly returns
zero in some cases when EOF has not yet been reached, but there
are no chars to be read yet.

I will do some more digging and hopefully come up with a test program.

                                       Tim N.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019