Hi team,

I compiled zookeeper 3.4.12 c client on solaris 11 machine and trying to test 
it through cli.sh. Here is the sample code that I changed in cli.c. Whenever I 
run the ./cli_mt file it always throws below error

2018-08-08 09:49:44,437:18000(0x2):ZOO_ERROR@handle_socket_error_msg@1670: 
Socket [10.272.80.184:4831] zk retcode=-4, errno=0(Error 0): connect() call 
failed. Anybody facing same issue?.

---------------------------------------------------------------------------------------------------------------------------
cli.c file
----------------

int main(int argc, char **argv) {
#ifndef THREADED
    fd_set rfds, wfds, efds;
    int processed=0;
#endif
    
    char p[2048];
#ifdef YCA  
    char *cert=0;
    char appId[64];
#endif
        char buffer[4096];
    int bufoff;
    //FILE *fh;
    struct Stat stat;
    int buflen= sizeof(buffer);
    int rc;

verbose = 0;
    zoo_set_debug_level(ZOO_LOG_LEVEL_WARN);
    zoo_deterministic_conn_order(1); // enable deterministic order
    hostPort = argv[1];
        printf("\n%s\n", "Lets connect");

    zh = zookeeper_init("sld06hzt:4831", watcher, 30000, &myid, 0, 0);
    if (!zh) {
        printf("\n%d\n", errno);
        return errno;
    }

    strcpy(p,"sadmin:ldap");
    zoo_add_auth(zh,"digest",p,strlen(p),0,0);

  rc = zoo_get(zh, "/test", 0, buffer, &buflen, &stat);
  
if (rc)  
{
 printf("\n%s\n", buffer);

}

 zookeeper_close(zh);
  return 2;
}


Regards,
Ashwini.

Reply via email to