#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Question Unable to connect to ldap server using delphi


    hi everyone,
    i've got a program to connect to a ldap server in delphi.
    in fact, i've written one on C which works, just after i translated it into delphi.. i'm using CodeGear Delphi for windows and the winldap class from Luk Vermeulen.

    my code is:

    ld : PLDAP;
    ld := ldap_init(PWideChar(sServeur), LDAP_PORT);
    if ld = nil then
    begin
    showMessage('ERROR: ldap_init: ' + ldap_err2stringW(GetLastError));
    goto labelFin;
    end

    ldap_set_optionW(ld, LDAP_OPT_PROTOCOL_VERSION, pointer(ld.ld_version));
    iRtn := ldap_connect(ld,nil);

    then the error message 0x51 for ldap_connect returned:
    Cannot contact the LDAP server.

    but at the meantime, i've tried my code C and it works perfectly.

    much thanks for your help
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    1
    Rep Power
    0
    Hi!

    I am interested in the c program that works. Could you give an example on what you have done and how you did it? I am using Borland C++Builder 6.

    /Brempa

    Originally Posted by yuefei
    hi everyone,
    i've got a program to connect to a ldap server in delphi.
    in fact, i've written one on C which works, just after i translated it into delphi.. i'm using CodeGear Delphi for windows and the winldap class from Luk Vermeulen.

    my code is:

    ld : PLDAP;
    ld := ldap_init(PWideChar(sServeur), LDAP_PORT);
    if ld = nil then
    begin
    showMessage('ERROR: ldap_init: ' + ldap_err2stringW(GetLastError));
    goto labelFin;
    end

    ldap_set_optionW(ld, LDAP_OPT_PROTOCOL_VERSION, pointer(ld.ld_version));
    iRtn := ldap_connect(ld,nil);

    then the error message 0x51 for ldap_connect returned:
    Cannot contact the LDAP server.

    but at the meantime, i've tried my code C and it works perfectly.

    much thanks for your help

IMN logo majestic logo threadwatch logo seochat tools logo