For HTTP connections, is there an API to set the keep-alive so that it doesn't expire?
See http://en.wikipedia.org/wiki/HTTP_persistent_connection for a good understanding of HTTP Keep-Alive.
Chilkat by-default uses HTTP v1.1 connections, and in HTTP v1.1 connections are already considered persistent unless declared otherwise. A Chilkat HTTP object instance will automatically keep the connection alive, unless the server's response contains a "Connection: Close" header, in which case the connection is closed. A Chilkat HTTP object will automatically keep up to 10 separate connections open. Once this is exceeded, the least-recently-used connection is closed to make room for the next. Therefore, if the same HTTP object instance is used for 20 HTTP GET requests to the same web server, then only one connection will be used.
It is possible to forcibly close all connections by calling the httpObject.CloseAllConnections method.
If one wishes to explicitly include a Keep-Alive header, such as one of the following:
Connection: Keep-Alive Keep-Alive: max=5, timeout=120This may be achieved by calling the httpObj.AddQuickHeader method prior to calling an HTTP method that does not use the HttpRequest object (such as QuickGetStr), or by calling requestObj.AddHeader for methods that use an HttpRequest object. Remember though: Keep-alive headers are just requests to keep the connection alive -- the server is not required to do it.