[cups-devel] IPP requests: Non-blocking or short timeout

Till Kamppeter till.kamppeter at gmail.com
Mon Sep 12 06:33:33 PDT 2016


Thank you very much for the help.

On 09/11/2016 03:22 PM, Michael Sweet wrote:
> The httpSetTimeout function can be used to manipulate the default read timeout for a given connection. But cupsDoRequest also attempts to reconnect on error (using a connection timeout of 30 seconds) so you might want to use cupsSendRequest and cupsGetResponse yourself to control the reconnect behavior...
>

I have tried the cupsSendRequest()/cupsGetResponse() now and what 
happens is that cupsSendRequest() exits immediately with some OK status 
and cupsGetResponse() hangs for more than one minute with status 100 
(HTTP_STATUS_CONTINUE). So the problem is that the server does not 
answer in time.

Calling "httpSetTimeout(http, 3, NULL, NULL);" before (3 sec timeout) 
does not help. Or do I have to define a callback here (which would for 
example kill the connection after the three seconds which I chosen as 
timeout). If I need a callback, how should it look like?

> Non-blocking mode might help, but it should not be necessary for this situation.  It sounds more like the remote server is going away but the reconnection is taking too long...

I would also prefer a solution based on short timeouts, as code is 
simpler then.

    Till




More information about the cups-devel mailing list