[Top][All Lists]

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

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

From: Tomalak Geret'kal
Subject: Re: [gpsd-users] gpsd performing orderly socket shutdown
Date: Tue, 03 Apr 2012 10:16:43 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1

On 01/04/2012 17:32, Håkan Johansson wrote:

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."

Interesting! Thanks; I will definitely bear this in mind.

However what I now realise I neglected to mention is that _all_ subsequent `read` calls return 0. Seems unlikely that the socket goes into a state where all data fails to pass checksum tests...?


reply via email to

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