LDAP_OPT_HOST_NAME

Use the LDAP_OPT_HOST_NAME setting to return a pointer to the host name for the original connection.

This setting is a read-only option that returns a pointer to the host name for the original connection, as specified on ldap_init(), ldap_open(), or ldap_ssl_init(). For example:
  char *hostname;
  ldap_get_option( ld, LDAP_OPT_HOST_NAME, &hostname);
Use ldap_memfree to free the memory that is returned by the call to ldap_get_option().