Platform SDK: Active Directory, ADSI, and Directory Services

ldap_connect

The ldap_connect function establishes a connection with the server.

ULONG ldap_connect(
  LDAP* ld,
  struct l_timeval* timeout
);

Parameters

ld
[in] The session handle.
timeout
[in] The number of seconds to spend in an attempt to establish a connection before timing out.

Return Values

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. See Return Values for more information.

Remarks

Ordinarily a client does not call ldap_connect to establish a connection to the server. If the connection does not already exist, other functions make the call internally. However, there may be times when you want to specify additional options on the connection block. For example, a client can call ldap_init to initialize a session, then call ldap_set_option to set a time-out on the connection block. The client then calls ldap_connect to connect to the server with a specified time-out.

For related information and a list of flags, see DsGetDcName.

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.

See Also

DsGetDcName, Establishing an LDAP Session, Functions, ldap_init, ldap_set_option, Return Values