amphiplex has asked for the wisdom of the Perl Monks concerning the following question:

Hi !

I have just experienced some problems with too many open connections to an LDAP server.
It looks like some script of mine is responsible for that, because I have never called unbind() but the script is running in mod_perl Registry mode.

Running some tests against netcat I saw that unbind() does not disconnect the socket, the network connection stays open.
I believe that this will only occur if the LDAP-server has a problem, but I would really like to make sure that the connection is closed.

Does anyone know of a way to close the socket using Net::LDAP ? I couldn't find anything in the docs.

Thanks,

---- amphiplex

Replies are listed 'Best First'.
Re: explicit disconnect in Net::LDAP
by mojotoad (Monsignor) on Nov 11, 2002 at 17:48 UTC
      Thank you, but I couldn't really find anything there either.
      Fortunately, a friend of mine looked into the code and found an undocumented method socket() which returns the socket used.

      So in case someone else has got troubles with buggy LDAP servers:
      my $ldap = Net::LDAP->new(...) .... $ldap->unbind() my $socket = $ldap->socket(); close $socket if $socket;

      ---- amphiplex