Platform SDK: Active Directory, ADSI, and Directory Services

cldap_open

The cldap_open function establishes a session with an LDAP server over a connectionless user datagram protocol (UDP) service.

LDAP* cldap_open(
  PCHAR HostName,
  ULONG PortNumber
);

Parameters

HostName
[in] A 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.
PortNumber
[in] Contains a host's port number, or a list of port numbers corresponding to the list of host names in the HostName parameter. If no port number is specified, the default is port 389. If a host includes a port number, this parameter is ignored.

Return Values

If the function succeeds, the return value is a session handle, in the form of a pointer to an LDAP structure.

If the function fails, the return value is NULL. To retrieve the error code, call LdapGetLastError or the Win32 function GetLastError.

Remarks

The cldap_open function, unlike ldap_open, creates a connection block for UDP-based connectionless LDAP services. No TCP session is maintained. Like ldap_open, cldap_open allocates an LDAP structure to maintain state information for the session, and then attempts to make the connection before returning to the caller. The call returns a session handle, which you pass to subsequent LDAP function calls in the course of the session.

Multithreading: Calls to cldap_open are thread-safe.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Winldap.h.
  Library: Use Wldap32.lib.
  Unicode: Declared as Unicode and ANSI prototypes.

See Also

Functions, GetLastError, ldap_open, LdapGetLastError