Need a fast test to see if a remote printer is available or not. Using CreateIC now, and when printer not up, 20 second delay
My application does a CreateIC (and later, an OpenPrinter) for the开发者_如何学JAVA user's default printer. When this is a remote printer, and that printer is powered down or otherwise not present on the network, it takes over 20 seconds for the CreateIC to return.
I'm looking for some call I can make that will give me a quick answer if the server is down (so I can return a status and not try to do the CreateIC/OpenPrinter).
My environment is c/c++ (non-managed).
I would recommend using the cURL library. They are available for all langues, allow you to hit addresses, and support timeouts. You could ping something on that IP address and make sure it responds in a quarter of a second, for instance.
Good luck!
精彩评论