timeout on bind() function
Michael Ströder
michael at stroeder.com
Tue Jul 2 19:28:48 CEST 2002
Olivier Guillossou wrote:
>
> I've a question: is there any option in the bind() function to make it
> raising a timeout exception ?
There's no timeout parameter for bind() method.
> I'm testing the python-ldap library, and I wouldn't like the program to
> hang if the LDAP server is down, for example.
If the server is really down you get a ldap.SERVER_DOWN when
firing the first LDAP operation (no matter which). The really
tricky things are servers which do accept the connection but don't
proceed.
> If there's no embedded timeout function, how can I make my program
> "timeouting" when the bind() function hangs ?
>>> import ldap
>>> l=ldap.open('localhost:1389')
>>> m=l.bind(ldap.AUTH_SIMPLE,'','')
>>> m=l.bind('','',ldap.AUTH_SIMPLE)
>>> r=l.result(m,1,30)
Hmm, is there any interest in setting a LDAPObject.timeout which
would automagically apply to all *_s() methods?
Ciao, Michael.
More information about the python-ldap
mailing list