Hi,

I m using openldap-2.3.38 over linux platform.

I have written a library using LDAP client API's according to my requirement.
I m having RPC clients and a RPC server. This RPC server is multithreaded and uses the library which is written using LDAP client api.

The problem is :
1. I have open a single connection with LDAP server and passed the global LDAP * ptr to all my library calls,
    And i sended a search request from rpc client in a loop,  it works and gives the result but as i run second request for
    reading data from rpc server then i get error from LDAP server "Broken pipe".

2. Then i have decided i will use seprate connection with LDAP for each thread and use a local LDAP *ptr for thread.
     This time multiple requests from rpc client works for 2-3 minutes after that it also gives error.
     "ldap_bind :Can't contact LDAP server"
     In this case i opened and closed a connection with LDAP server for each thread.

Please suggest me some solution for handling multiple threads with LDAP client API.
In case of Solaris i got a sample for handling multiple threads with LDAP client api's.

But this solution doesn't work over Linux.

Please give me some solution.

Thanks