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

2014-12-31 Thread Paul Newall

On 30/12/14 17:26, Paul Newall wrote:

On 30/12/14 10:18, Louis Lagendijk wrote:

On Tue, 2014-12-30 at 10:09 +, 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



Thank you Louis, that was very helpful.
It seems that the scanner initiates keep-alive exchanges every 3 
seconds for around 27 seconds, then it closes the connection.


I had assumed the normal thing would be to open the connection in 
sane_open, and close it in sane_close,
but perhaps it's better to open the connection in sane_start, and 
close it in sane_cancel.


Or I could leave things more or less as they  are, but detect the loss 
of connection and reopen it if required.


Paul



I have now made the changes to open the connection in sane_start, and close
it in sane_cancel. And that seems to have solved the problem without breaking 
anything else.

Paul







--
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
to sane-devel-requ...@lists.alioth.debian.org


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

2014-12-30 Thread Paul Newall

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

On 28/12/14 23:50, Paul Newall wrote:

This was using xsane.
If I close xsane and reopen it I can scan again.
Paul

On 28/12/14 20:40, m. allan noah wrote:

Are you using a long-running front-end like xsane, or multiple
invocations of something like scanimage?

allan

On Sun, Dec 28, 2014 at 3:24 PM, Paul Newall p.newa...@ntlworld.com 
wrote:
I found, using the kodakaio backend, that leaving the scanner idle 
between

scans for more than around 40sec gives an i/o error when I try to scan
again.
I can scan any number of times with gaps of less than 30 sec between 
scans

without getting this error.

Has anyone ever had a similar experience with any other backend?

Does anyone have an idea what might be the cause?

--
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org









--
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
to sane-devel-requ...@lists.alioth.debian.org


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

2014-12-30 Thread Paul Newall

On 30/12/14 10:18, Louis Lagendijk wrote:

On Tue, 2014-12-30 at 10:09 +, 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



Thank you Louis, that was very helpful.
It seems that the scanner initiates keep-alive exchanges every 3 seconds 
for around 27 seconds, then it closes the connection.


I had assumed the normal thing would be to open the connection in 
sane_open, and close it in sane_close,
but perhaps it's better to open the connection in sane_start, and close 
it in sane_cancel.


Or I could leave things more or less as they  are, but detect the loss 
of connection and reopen it if required.


Paul



--
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
to sane-devel-requ...@lists.alioth.debian.org


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

2014-12-28 Thread m. allan noah
Are you using a long-running front-end like xsane, or multiple
invocations of something like scanimage?

allan

On Sun, Dec 28, 2014 at 3:24 PM, Paul Newall p.newa...@ntlworld.com wrote:
 I found, using the kodakaio backend, that leaving the scanner idle between
 scans for more than around 40sec gives an i/o error when I try to scan
 again.
 I can scan any number of times with gaps of less than 30 sec between scans
 without getting this error.

 Has anyone ever had a similar experience with any other backend?

 Does anyone have an idea what might be the cause?

 --
 sane-devel mailing list: sane-devel@lists.alioth.debian.org
 http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
 Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org



-- 
well, I stand up next to a mountain- and I chop it down with the edge
of my hand

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org


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

2014-12-28 Thread Paul Newall

This was using xsane.
If I close xsane and reopen it I can scan again.
Paul

On 28/12/14 20:40, m. allan noah wrote:

Are you using a long-running front-end like xsane, or multiple
invocations of something like scanimage?

allan

On Sun, Dec 28, 2014 at 3:24 PM, Paul Newall p.newa...@ntlworld.com wrote:

I found, using the kodakaio backend, that leaving the scanner idle between
scans for more than around 40sec gives an i/o error when I try to scan
again.
I can scan any number of times with gaps of less than 30 sec between scans
without getting this error.

Has anyone ever had a similar experience with any other backend?

Does anyone have an idea what might be the cause?

--
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org






--
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
to sane-devel-requ...@lists.alioth.debian.org