[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ldap
Subject:    Re: Strange behavior of ldap_result - can someone explain?
From:       Mark Smith <mcs () netscape ! com>
Date:       1996-09-18 20:57:55
[Download RAW message or body]

Nils Andreas Thommesen wrote:
> 
> I have made an LDAP-application that was not very effective on the "list"
> operation. I thought this was partly due to the way LDAP uses search to
> accomplish list, instead of having a separate list operation. I was
> wrong!
> ...
> So, even though a server might give my application the result in less
> than 1/4 seconds, I still have to call ldap_result at least as many times
> as there are entries to be returned, meaning if I call it every second,
> the operation will take <no of entries> seconds!!! Why is it so?
> ...

In the U-M LDAP 3.3 release at least, a single call to ldap_result()
with a zero-ed timeout structure will read at most one entry or result
from the server.  This is a feature -- the assumption is that if you are
polling you don't want to stay inside libldap very long.  Since you are
passing a non-zero value for "all", it makes sense that you need to call
ldap_result() once for each entry and once to get the search result (at
least).

A better way to go is to pass zero for "all" and keep calling
ldap_result() as long as it returns an entry or result.  Another
alternative is to pass a non-zero timeout value (it can be quite small
-- say 1/10th of a second) to give ldap_result() more time to do its
thing.

--  
Mark Smith                                 Netscape Communications Corp.
The opinions I express are my own.         Directory Server Engineering

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic