[sane-devel] Network connected scanner, i/o error if scanner is idle for longer then 40sec

Louis Lagendijk louis at fazant.net
Tue Dec 30 10:18:42 UTC 2014


On Tue, 2014-12-30 at 10:09 +0000, Paul Newall wrote:
> I have been digging down into the code, and adding extra debug output.
> In my network read function kodakaio_net_read it seems that poll(...) is 
> indicating that there is data to read, but sanei_ tcp_read(..) then 
> returns zero bytes.
> If there was no data I'd expect poll to timeout, and if there was some 
> data, sanei_ tcp_read should return it?
> But this is the only network read code I have ever written in c so I am 
> not too confident it is correct.
> 
> Paul
A read returning 0 bytes when the fd is ready indicates that the other
side closed the TCP-connection. you probably need to send some form of
keep-alive or close/ the connection when you don't need it and re-open
the connection later.
Louis




More information about the sane-devel mailing list