From: <mi...@st...> - 2004-09-14 13:23:18
|
Kai, sorry for answering late. Steverding, Kai wrote: > Now i have the > problem, that the client hangs for about 3 minutes if the servers istn't > available. (eg the server reboots,so there is no connection refused or > something like that). I simulated this by using a firewall rule dropping IP packets. > I'd like to throw an error if the server-bind doesn't > work after 20 seconds or so. I found the timeout for result, but nothing > about a "bind-timeout". What can i do ? Use something like this for setting the network timeout before the simple bind: l = LDAPObject(ldap_url.initializeUrl()) l.protocol_version = 3 l.network_timeout = 2.5 # connect timeout 2500 msec l.simple_bind_s() Note that the l.simple_bind_s() raises the LDAPError exception ldap.SERVER_DOWN, not ldap_url.initializeUrl(). The behaviour might only work with recent python-ldap (2.0.0pre14+ according to CHANGES) and OpenLDAP libs (tested on my system with python-ldap 2.0.2 and OpenLDAP 2.2.17 libs). Ciao, Michael. |