[sane-devel] Setting a timeout for the net backend?
aguynamedryan at gmail.com
Wed Oct 10 00:04:42 UTC 2007
Is there a way to shorten the timeout of the "net backend" so that
after about 10 seconds without a response from a computer running
saned, scanimage -L will move on and not hang around for minutes on
end awaiting a response?
Long version (for those who need more context):
I have a total of 5 Fujitsu scanners at 5 remote locations. Each
Fujitsu is attached to a computer (which I'll call a "scan-computer")
running saned. The scan-computers all live on the same VPN so a 6th,
central, computer can safely use the net backend to connect to the
scanners via the scan-computers.
This setup works relatively well. Running a "scanadf -L" to get the
list of scanners only takes ~4-5 seconds.
That is until one of the VPN connections is severed, either because
someone turns off a scan-computer, or someone's DSL is down or
something. When that happens, running a "scanadf -L" on my central
computer ends up taking 5-6 minutes! This delay is crippling to my
I've looked around and I can't seem to find a way to set a shorter
timeout value for the net backend. net.conf doesn't seem to provide
a way to pass a value and there doesn't seem to be an environment
variable I can set. I'm even willing to find some global TCP timeout
variable that would shorten the timeout for all TCP connections
initiated by my central server.
Lastly, I'm willing to patch the net.c file to use the setsockopt
call to lower the SO_RCVTIMEO to a value defined in some environment
variable, say "SANE_NET_TIMEOUT". The last option seems a bit
drastic, so I'm hoping there is a better/easier way.
More information about the sane-devel