Connect to a printer that is offline

S Sonu Kapoor 3 years 7 months ago
78 3 0

HI,
 
I notice that when connecting to an printer that is either offline or not visible on the network by using a wrong IP the [printer conn] call takes a while to complete. Is there a way to prevent this long wait?
Is there a timeout that I can set somewhere?
 
Thanks

Please Register or Login to post a reply

3 Replies

E Efkan YILMAZ

Hi Sonu, I'm going to correct myself and tell you to use the NetworkDiscovery class in the SDK.  The findPrinters(DiscoveryHandler discoveryHandler, List printersToFind, int waitForResponsesTimeout) function has a parameter for timeout (int waitForResponsesTimeout).  You can use this function even if you know the IP of the printer you want (List printersToFind).  My same warnings will hold true though, if you make the timeout too low, it may miss printers.  It's a callback function as well, so you don't have to worry about freezing the app while you wait.
Robin

E Efkan YILMAZ

Hi Sonu,
You can set the maxTimeoutForRead when you create a new connection.  Keep in mind, if you do this, it may miss your printer.  If the network is slow, or the printer is at the limit of it's range, or there are a lot of printers availible, all can cause it to take longer to find. 
Hope this helps,
Robin

S Sonu Kapoor

Anybody?

CONTACT
Can’t find what you’re looking for?