From: Jerry L. <te...@ho...> - 2003-03-04 18:09:43
|
Hi Michael, Thanks for the response. >From: Michael Ströder <mi...@st...> >To: Jerry Lee <te...@ho...> >CC: pyt...@li... >Subject: Re: Blocking bind.... >Date: Tue, 04 Mar 2003 17:31:23 +0100 > >Jerry Lee wrote: >> >>I recently posted to the list about a problem I am having with bind >>blocking for a long time before it times out if the server isn't there. > >You can elaborate on "the server isn't there"? > The machine doesn't exist - an ip address that I can't ping. I'm writing a QT-based LDAP browser and I want to make it user friendly. Give the user an option of cancelling a request if they typed the wrong IP address (for example) > >>Mario Cicognini (thx Mario!!) was kind enough to suggest the following: >> >> l = ldap.open(LDAPServer) >> id = l.simple_bind(LDAPbindUsername, LDAPbindPassword) >> status,res = l.result(id, 1, 60) >> if status != 'RES_BIND': >> return -1 >> >>which I tried with no success. > >First note that the connection timeout part is done within OpenLDAP libs. >It might be worth testing with newer OpenLDAP lib version 2.1.x. There's >nothing more you can do at Python level. > How do I set the TIMEOUT values with set_option. Could you give me an example of how to set OPT_TIMEOUT and OPT_NETWORK_TIMEOUT to 10 secs?? I had thought from reading the python-ldap docs that simple_bind was an asynchronous operation - that control would be returned to my program immediately after issuing the request. However, on my machine, it blocks - and then times out after around 90secs. Kind of annoying. Is the synchronous/asynchronous nature of the call controlled in the python-ldap module or is it a function of the OpenLDAP libs?? >>My app blocks at the >>id = l.simple_bind(LDAPbindUsername, LDAPbindPassword) >>line and doesn't return until around 90secs later. > >Note that opening the connection is deferred until attempting first the >LDAP operation. The ldap_initialize() function of OpenLDAP libs just >returns a LDAP connection struct without actually connecting to the server. >I guess your simple bind is the first LDAP operation. > >Ciao, Michael. Yes, this seems to be OK. I get program control back immediately after the ldap_open (ldap_initialie worked the same way). Thanks for the response and many thanks for the work you've done on python-ldap. You've helped make developing the app a much simpler task and even kind of fun!! Yours, Jerry. _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail |
From: Jerry L. <te...@ho...> - 2003-03-04 20:16:29
|
Hi Michael, >From: Michael Ströder <mi...@st...> >To: Jerry Lee <te...@ho...> >CC: pyt...@li... >Subject: Re: Blocking bind.... >Date: Tue, 04 Mar 2003 19:30:08 +0100 > >Jerry Lee wrote: >>Michael Ströder wrote: >>>Jerry Lee wrote: >>>> >>>>I recently posted to the list about a problem I am having with bind >>>>blocking for a long time before it times out if the server isn't there. >>> >>>You can elaborate on "the server isn't there"? >> >>The machine doesn't exist - an ip address that I can't ping. > >I think it depends whether and which ICMP response your LDAP client >receives in this case. > >>How do I set the TIMEOUT values with set_option. >>Could you give me an example of how to set OPT_TIMEOUT and >>OPT_NETWORK_TIMEOUT to 10 secs?? > > >>> l.set_option(ldap.OPT_TIMELIMIT,60.0) > >>> l.get_option(ldap.OPT_TIMELIMIT) >60 > No joy. The option got set OK but it still doesn't timeout after the TIMELIMIT I specify. >>Is the synchronous/asynchronous nature of the call controlled in the >>python-ldap module or is it a function of the OpenLDAP libs?? > >It's controlled in the OpenLDAP libs. Updating OpenLDAP could be a good >idea. > >My attempt to implement a result() method which controls the timeout was a >CPU hog. > >Ciao, Michael. I'm going to update my OpenLDAP later this week. I'll keep you posted on the results. Thanks for all your help, Jerry. _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail |
From: <mi...@st...> - 2003-03-04 18:30:31
|
Jerry Lee wrote: > Michael Str=F6der wrote: >> Jerry Lee wrote: >>> >>> I recently posted to the list about a problem I am having with bind=20 >>> blocking for a long time before it times out if the server isn't ther= e. >> >> You can elaborate on "the server isn't there"? >=20 > The machine doesn't exist - an ip address that I can't ping. I think it depends whether and which ICMP response your LDAP client recei= ves=20 in this case. > How do I set the TIMEOUT values with set_option. > Could you give me an example of how to set OPT_TIMEOUT and=20 > OPT_NETWORK_TIMEOUT to 10 secs?? >>> l.set_option(ldap.OPT_TIMELIMIT,60.0) >>> l.get_option(ldap.OPT_TIMELIMIT) 60 > Is the synchronous/asynchronous nature of the call controlled in the=20 > python-ldap module or is it a function of the OpenLDAP libs?? It's controlled in the OpenLDAP libs. Updating OpenLDAP could be a good i= dea. My attempt to implement a result() method which controls the timeout was = a=20 CPU hog. Ciao, Michael. |