Compartir a través de


ldap_open (Windows CE 5.0)

Send Feedback

This function creates and initializes a connection block, and then opens the connection to an LDAP server. This function is currently depreciated: users are strongly encouraged to use ldap_init instead.

LDAP* ldap_open(UNICODE PTCHARHostName,ULONGPortNumber);

Parameters

  • HostName
    [in] Domain name, list of host names, or dotted strings representing the IP address of LDAP server hosts. Use a single space to separate the host names in the list. Each host name in the list may be followed by a port number. The optional port number is separated from the host itself with a colon (:) character. The LDAP run time attempts connection with the hosts in the order listed, stopping when a successful connection is made.

    Note   Only ldap_open attempts to make the connection before returning to the caller. The ldap_init function does not connect to the LDAP server.

  • PortNumber
    [in] Contains the TCP port number to which to connect. The default LDAP port, 389, can be obtained by supplying the constant LDAP_PORT. If a host name includes a port number then this parameter is ignored.

Return Values

If this function succeeds, it returns a session handle in the form of a pointer to an LDAP data structure.

If this function fails, it returns NULL. Use the LdapGetLastError function to retrieve the error code.

Remarks

Call this function to create a connection block to an LDAP server. The HostName parameter can be NULL, in which case the run time attempts to find the default LDAP server. The host names are tried in the order listed, stopping with the first successful connection.

The default LDAP server is a Microsoft specific option when you use LDAP_OPT_HOST_NAME. This option specifies the host name of the default LDAP server and returns the host name.

This function allocates an LDAP data structure to maintain state information for the session and returns a handle to this structure. You can pass this handle to subsequent LDAP function calls during the course of the session.

In a multithreading environment, calls to this function are thread-safe.

The use of this function is strongly depreciated by the current LDAP request for comments (RFC) because it precludes the use of setting any session options. Users are encouraged to use ldap_init as the preferred method of initializing an LDAP session.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Winldap.h.
Link Library: Wldap32.lib.

See Also

cldap_open | ldap_init | LdapGetLastError

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.