login about faq

For HTTP connections, is there an API to set the keep-alive so that it doesn't expire?

asked Dec 03 '12 at 13:44

chilkat's gravatar image

chilkat ♦♦

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=120
This 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.


answered Dec 03 '12 at 13:56

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Dec 03 '12 at 13:44

Seen: 3,017 times

Last updated: Dec 03 '12 at 13:56

powered by OSQA