Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1020

Implement function in C client to determine which host you're currently connected to.

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.4.0
    • c client
    • None
    • Reviewed

    Description

      On occasion it might be useful to determine which host your Zookeeper client is currently connected to, be it for debugging purposes or otherwise. A possible signature for that function:

      const char* zoo_get_connected_host(zhandle_t *zh, char *buffer, size_t buffer_size, unsigned short *port);

      Clients could use it like below:

      char buffer[33];
      unsigned short port = 0;
      if (!zoo_get_connected_host(zh, buffer, sizeof(buffer), &port))
      return EXIT_FAILURE;

      printf("The connected host is: %s:%d\n", buffer, port);

      Attachments

        1. ZOOKEEPER-1020.patch
          3 kB
          Stephen Tyree

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tyree731 Stephen Tyree
            tyree731 Stephen Tyree
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment