DescriptionReturns a SLPHandle handle in the phslp parameter for the language locale passed in as the lang parameter. The client indicates if operations on the handle are to be synchronous or asynchronous through the isasync parameter. The handle encapsulates the language locale for SLP requests issued through the handle, and any other resources required by the implementation. The return value of the function is an SLPError code indicating the status of the operation. Upon failure, the phslp parameter is NULL.
An SLPHandle can only be used for one SLP API operation at a time. If the original operation was started asynchronously, any attempt to start an additional operation on the handle while the original operation is pending results in the return of an SLP_HANDLE_IN_USE error from the API function. The SLPClose() API function terminates any outstanding calls on the handle. If an implementation is unable to support a asynchronous( resp. synchronous) operation, due to memory constraints or lack of threading support, the SLP_NOT_IMPLEMENTED flag may be returned when the isasync flag is SLP_TRUE (resp. SLP_FALSE).
In the OpenSLP implementation, SLPHandles are used to cache information that is costly to obtain (in terms of network usage and time). Since the RFC 2614 API does not specify functions to initialize the implementation library, OpenSLP keeps track of the number of SLPHandles that are open. Several global library data structures are initialized when the first SLPHandle is opened and maintained until the last SLPHandle is closed. Therefore, it is most efficient to leave SLPHandles open for as long as you will need them (often for the entire life of a process). If you can help it, DO NOT make a habit of opening and closing SLPHandles frequently.
Be aware, especially if the call is async, of error codes that may be
passed to the SLPRegReport() callback function.