[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: OpenLDAP API: why to use asynchronous functions?



Hallvard B Furuseth wrote:
johnmiller@email.it writes:
why should I use asynchronous functions?

Your application might have some other work to do.  Like responding to
user input, if it's an interactive application.  Then you can send the
LDAP request, do some work, check for the LDAP response, if it has not
arrived do some more work, and so on.

Also you don't need to wait for the response to one LDAP request before
sending the next, except with Bind and Start TLS.

Another advantage is that if entries returned by a search can be independently handled by the client, you don't have to wait for the whole dataset to be available to start handling it.

From the LDAP client point of view, do they use less memory or more?

The ldap_<foo>_s() functions are just wrappers around ldap_<foo>()
followed by ldap_result() and maybe ldap_result2error().  So you might
get them to use less memory on errors if you cripple your error
handling, but otherwise it should make little difference.

Well, in case of a search that returns a lot of objects, using an asynchronous call will give you a chance to deal with entries as soon as they come in, so you might end up using less memory.

p.