SetKeepAlive

Indicates whether to make a persistent connection to the Internet resource. This method is available for .NET Web services engine only.

Syntax

conn.SetKeepAlive (boolean value)

Argument Description
conn The name of the SoapConnection object that establishes the connection.
value A boolean value that, when true, indicates that the request to the Internet resource contains a Connection HTTP header with the value Keep-alive. The default is true.

Results

Long. Valid values are 0 for success and 50 for failure.

Usage

Use SetKeepAlive(true) to send a Connection HTTP header with the value Keep-Alive, which indicates a preference for persistent connections. When calling SetKeepAlive(true), the application makes persistent connections to the servers that support them.

When using HTTP/1.1, Keep-Alive is on by default. SetKeepAlive(false) may send a Connection: Close header to the server.

If you get the error message "The underlying connection was closed: A connection that was expected to be kept alive was closed by the server" when you call the Web service, you can attempt to call SetKeepAlive(false) before you create the proxy object.