From: Graham B. <gb...@po...> - 2000-06-20 20:57:21
|
Hm, I am not sure many people have used async, but here goes. With async the ->search method will return immediately. You will then have to check for data on the socket, you can get this from $ldap->socket. You can use select() to determine when there is something ready, and when there is call $ldap->_recvresp (this method needs to be renamed) _recvresp will read everything it can from the socket and process it. You can check if the search has completed with $mesg->done, any other method called will cause Net::LDAP to block until the search has completed. This is where the async code really needs work as it is not really async as there are cases where it will still block. It needs to be made to return error values (probably undef) and have a way for the API to show something equivalent to EWOULDBLOCK. Graham. So in code terms $ldap->async(1); $mesg = $ldap->search(...); $sel = IO::Select->new( $ldap->socket ); do { $sel->can_read( $timeout ) or die "Bang!"; $ldap->_recvresp(); } until ($mesg->done); On Tue, Jun 20, 2000 at 03:14:03PM -0500, Bryan Thale wrote: > OK, maybe I can use the async capability instead. How do I test to determine > if an async request has completed? It looks like the sync method will also > wait forever. > > Bryan. > > -- > Bryan Thale > Motorola Labs, Networking and Infrastructure Research > mailto:th...@rs... > > Graham Barr wrote: > > > The timeout argument to search is a parameter given to the server > > as a timeout for the query. It is not a timeout that Net::LDAP uses to > > determine how long to wait. > > > > Net::LDAP does not have this, maybe it should. This is something to > > think about. > > > > Graham. > > > > |