Skip to Content.
Sympa Menu

freetds - Re: Bug in read.c

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: SMASKELL AT UP.COM
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: Bug in read.c
  • Date: Thu, 23 May 2002 13:24:53 -0500



> when I get read of 0 bytes, I usually do a select(...NULL...,
> timeout) to pause for a predetermined amount of time without
> chewing up cpu, to allow more data to arrive.
>
> if the socket is broken, and not just out of data, check for
> that condition with a select and error conditions setting.
>

Not necessary, or shouldn't be. If there's no data available then a
blocking read should block (which doesn't eat CPU) and a nonblocking read
should return EAGAIN. In my case it's blocking so it should block until
data arrives. The fact that it returns 0 immediately tells you that the
connection has been broken/closed and you should close the socket.

Scott





Archive powered by MHonArc 2.6.24.

Top of Page