Which one takes precedence?
Say you create a new LdapConnection and set its Timeout property to 30 seconds.
LdapConnection ldapConn = new LdapConnection(hostName + ":" + port)
{
Timeout = TimeSpan.FromSeconds(30)
}
Later when you submit a SearchRequest, you also specify a timeout of 30 seconds again as follows:
var response = (SearchResponse)connection.SendRequest(req, TimeSpan.FromSeconds(30));
The connection obviously lives longer than the request so I would expect the second timeout to be associated with the request, with the first one associated with the connection. Does not make any sense when I think about it, so I ask you the experts. Since the connection was created with a timeout, does it's timeout take precedence?
The connection times out 30 seconds after you last use it. The search request times out 30 seconds after you submit it. If you submit a search request 31 seconds after you last used the connection, you will get a connection timeout. If you submit it sooner, it will time out after 30 seconds, as a search timeout, as the connection is still in use for the search.