Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-108

getaddrinfo not working

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 0.5
    • 0.4
    • None
    • C, Cocoa/iOS

    Description

      Hi there,

      I'd like to use the mongo-c-driver in a new iOS project, and I'm following the tutorial (http://api.mongodb.org/c/current/tutorial.html), but I can't successfully connect to a mongolab.com database of my creation. I can connect to the mongolab db at the command line ("mongo ds029807.mongolab.com:29807/starwatch_1", for example), so I know it exists. I've tried several variations of ip and port declarations such as the following (in objective-C) and it compiles and runs successfully, but it does not connect to my mongolab db:

      mongo conn[1];

      NSString * ip = @"ds029807.mongolab.com";
      int port = 1234; // dummy port number for now

      int status = mongo_connect(conn, (char*)ip, port);

      if( status != MONGO_OK )

      { ... }

      ... more code below

      The conn->err value is always MONGO_CONN_FAIL, even if I append the ":1234" port number at the end of the ip string, or other ways.

      Have you connected to a mongolab collection with this library before? Could you give me guidance on how the syntax would work, or if I'm barking up the wrong tree? Googling the topic didn't shed any light on the subject. I've worked successfully with perl and python mongo libraries with mongolab, and I'm hoping I can do the same in C/Objective-C.

      Thank you!
      Natalie

      Attachments

        Activity

          People

            kbanker Kyle Banker
            nataliepo natalie po
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: