Share via


ServiceClientTransportSettings.ConnectionLeaseTimeoutMilliseconds Property

Definition

How long, in milliseconds, a given cached TCP connection created by this client's HTTP layer will live before being closed. If this value is set to any negative value, the connection lease will be infinite. If this value is set to 0, then the TCP connection will close after each HTTP request and a new TCP connection will be opened upon the next request.

public int ConnectionLeaseTimeoutMilliseconds { get; set; }
member this.ConnectionLeaseTimeoutMilliseconds : int with get, set
Public Property ConnectionLeaseTimeoutMilliseconds As Integer

Property Value

Remarks

By closing cached TCP connections and opening a new one upon the next request, the underlying HTTP client has a chance to do a DNS lookup to validate that it will send the requests to the correct IP address. While it is atypical for a given IoT hub to change its IP address, it does happen when a given IoT hub fails over into a different region. Because of that, users who expect to failover their IoT hub at any point are advised to set this value to a value of 0 or greater. Larger values will make better use of caching to save network resources over time, but smaller values will make the client respond more quickly to failed over IoT hubs.

Applies to