0

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?

Moslem Ben Dhaou
  • 6,897
  • 8
  • 62
  • 93
Klaus Nji
  • 18,107
  • 29
  • 105
  • 185

1 Answers1

1

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Thanks, To add, connection timeout also determines how long we need to wait after attempting to bind. This is what I found later. – Klaus Nji Mar 26 '15 at 23:49