开发者

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

开发者 https://www.devze.com 2023-01-02 10:08 出处:网络
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

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消