Hi, we had massive problems with LDAP clients blocking in the connect() system call. So I wrote a patch against libldap/os-ip.c which uses a non-blocking socket and select() to avoid this. To set/get the timeout, I used the yet unused LDAP_OPT_TIMEOUT option flag in ldap.h. With the patch applied you could set the TCP connect timeout by using ld = ldap_init(host, LDAP_PORT); int timeout = 10; ldap_set_option(ld, LDAP_OPT_TIMEOUT, &timeout); ldap_simple_bind_s(ld, ...); if timeout == -1, connect will block as usual if timeout == 0, connect will return immediatly if timeout > 0, wait n seconds for connect to return Also, by using a non-blocking socket, it is now possible to enable the 'async' parameter to ldap_connect_to_host. regards, Lars Uffmann -- Lars Uffmann, <lars.uffmann@mediaWays.net>, fon +49 5241 80 1438
Attachment:
osip-timeoutcon.patch.gz
Description: GNU Zip compressed data