[Top][All Lists]

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

Re: [gpsd-users] gpsd performing orderly socket shutdown

From: Håkan Johansson
Subject: Re: [gpsd-users] gpsd performing orderly socket shutdown
Date: Sun, 1 Apr 2012 18:32:15 +0200
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Fri, 30 Mar 2012, Tomalak Geret'kal wrote:


Our approach is pretty simple... a `select` call followed by a `read` call, in a loop. The socket is a blocking socket.

Intermittently, though, (say every 3-8 hours) on a particular device, we're seeing `select` return >0 then `read` return 0. Allegedly this non-error condition implies an orderly shutdown on the remote end.

Might this be a case of (from select(2) man page, section BUGS)?:

"Under Linux, select() may report a socket file descriptor as "ready for
reading", while nevertheless a subsequent read blocks.  This could  for
example  happen  when  data  has arrived but upon examination has wrong
checksum and is discarded.  There may be other circumstances in which a
file  descriptor is spuriously reported as ready.  Thus it may be safer
to use O_NONBLOCK on sockets that should not block."


reply via email to

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