<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:08:29 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-108] getaddrinfo not working</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-108</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Hi there,&lt;/p&gt;

&lt;p&gt;I&apos;d like to use the mongo-c-driver in a new iOS project, and I&apos;m following the tutorial (&lt;a href=&quot;http://api.mongodb.org/c/current/tutorial.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://api.mongodb.org/c/current/tutorial.html&lt;/a&gt;), but I can&apos;t successfully connect to a mongolab.com database of my creation. I can connect to the mongolab db at the command line (&quot;mongo ds029807.mongolab.com:29807/starwatch_1&quot;, for example), so I know it exists. I&apos;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:&lt;/p&gt;


&lt;p&gt;   mongo conn&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;   NSString * ip = @&quot;ds029807.mongolab.com&quot;;&lt;br/&gt;
   int port = 1234;     // dummy port number for now&lt;/p&gt;


&lt;p&gt;   int status = mongo_connect(conn, (char*)ip, port);&lt;/p&gt;

&lt;p&gt;   if( status != MONGO_OK ) &lt;/p&gt;
{
      ...
   }

&lt;p&gt;   ... more code below&lt;/p&gt;


&lt;p&gt;The conn-&amp;gt;err value is always MONGO_CONN_FAIL, even if I append the &quot;:1234&quot; port number at the end of the ip string, or other ways.  &lt;/p&gt;

&lt;p&gt;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&apos;m barking up the wrong tree?  Googling the topic didn&apos;t shed any light on the subject.  I&apos;ve worked successfully with perl and python mongo libraries with mongolab, and I&apos;m hoping I can do the same in C/Objective-C.&lt;/p&gt;

&lt;p&gt;Thank you!&lt;br/&gt;
Natalie&lt;/p&gt;</description>
                <environment>C, Cocoa/iOS</environment>
        <key id="28623">CDRIVER-108</key>
            <summary>getaddrinfo not working</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="kbanker">Kyle Banker</assignee>
                                    <reporter username="nataliepo">natalie po</reporter>
                        <labels>
                            <label>mongolab</label>
                    </labels>
                <created>Wed, 18 Jan 2012 21:08:36 +0000</created>
                <updated>Wed, 19 Oct 2016 14:14:50 +0000</updated>
                            <resolved>Fri, 20 Jan 2012 15:14:54 +0000</resolved>
                                    <version>0.4</version>
                                    <fixVersion>0.5</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="81241" author="kbanker" created="Fri, 20 Jan 2012 15:14:54 +0000"  >&lt;p&gt;You&apos;re welcome!&lt;/p&gt;</comment>
                            <comment id="81134" author="nataliepo" created="Thu, 19 Jan 2012 23:06:18 +0000"  >&lt;p&gt;Great! I&apos;ve confirmed that this works for me in a simple C script.  Now I just need to work on linking the right files in my iOS project.  Thanks very much, Kyle!&lt;/p&gt;</comment>
                            <comment id="81118" author="kbanker" created="Thu, 19 Jan 2012 22:17:16 +0000"  >&lt;p&gt;Yes. Here&apos;s a basic test script:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://gist.github.com/55ed6c59d9deb3a7f49b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://gist.github.com/55ed6c59d9deb3a7f49b&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here&apos;s how I compile the library:&lt;br/&gt;
scons --use-platform=LINUX&lt;/p&gt;

&lt;p&gt;Here&apos;s how I compile the test script:&lt;br/&gt;
gcc --std=c99 test.c libmongoc.a&lt;/p&gt;</comment>
                            <comment id="81113" author="nataliepo" created="Thu, 19 Jan 2012 21:59:23 +0000"  >&lt;p&gt;Thanks, Kyle, for taking a look.  I&apos;m still not having luck connecting to my mongolab db.  As a sanity check, is this along the same lines of the syntax you&apos;re using?&lt;/p&gt;


&lt;p&gt;mongo conn&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;;&lt;br/&gt;
int port_num = 5678;&lt;br/&gt;
char * ip = &quot;subdomain1234.mongolab.com&quot;;&lt;/p&gt;

&lt;p&gt;int status = mongo_connect(conn, ip, port_num);&lt;/p&gt;


&lt;p&gt;My connection result still results in failure (-1).&lt;/p&gt;


&lt;p&gt;Thanks again for helping with this!&lt;/p&gt;
</comment>
                            <comment id="81103" author="kbanker" created="Thu, 19 Jan 2012 21:42:12 +0000"  >&lt;p&gt;I&apos;ve just pushed a small fix, and I tested it with a MongoLab database, and it worked! Please let me know if you have any problems with it.&lt;/p&gt;</comment>
                            <comment id="81062" author="kbanker" created="Thu, 19 Jan 2012 20:09:09 +0000"  >&lt;p&gt;Thanks, Natalie. Will commit a fix later this afternoon.&lt;/p&gt;</comment>
                            <comment id="80810" author="nataliepo" created="Wed, 18 Jan 2012 22:16:55 +0000"  >&lt;p&gt;Thanks, Kyle, for the fast response!&lt;/p&gt;

&lt;p&gt;I&apos;ve got the code from the latest release (commit: 879b67c40a6d2ee284c7a99b13ded8b1b6535109), and I ran scons to rebuild the files.  My project now includes the net.* files that include comments about the Linux version, and I removed the other net.* files from my project (since they borked on methods being declared twice, as expected).&lt;/p&gt;

&lt;p&gt;I&apos;m stepping through the following call in my project&apos;s debugger:&lt;/p&gt;

&lt;p&gt;  int status = mongo_connect(conn, &quot;ds029807.mongolab.com&quot;, 29807);&lt;/p&gt;


&lt;p&gt;and here&apos;s my rough stack trace of where it&apos;s failing (adding arrows for hopefully easier indentations and reading):&lt;/p&gt;

&lt;p&gt;mongo.c - mongo_connect():&lt;br/&gt;
&amp;gt;&amp;gt; if (mongo_socket_connect(conn, host, port) != MONGO_OK)&lt;br/&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; //net.c - mongo_socket_connect():&lt;br/&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; // it creates a socket using mongo_create_socket(conn) just fine&lt;br/&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; // then it initializes the &apos;sa&apos; struct&lt;br/&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if (connect (conn-&amp;gt;sock, (struct sockaddr*)&amp;amp;sa, addressSize) == -1)&lt;br/&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ^^^ This is where it&apos;s failing.  The port value is correct here, but the sa.sin_addr.s_addr value doesnt match my host string, but I&apos;d expect it to be shifted like the port was, so it may be okay, or it might be the resolving host name issue that you mentioned. &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;Thanks again for taking a close look at this!&lt;br/&gt;
Natalie&lt;/p&gt;




</comment>
                            <comment id="80794" author="kbanker" created="Wed, 18 Jan 2012 21:13:28 +0000"  >&lt;p&gt;I need to make a new release, but you&apos;re probably running into an issue resolving the host name. Please checkout from head (i.e., the latest commit). Then compile like so:&lt;/p&gt;

&lt;p&gt;scons --use-platform=LINUX&lt;/p&gt;

&lt;p&gt;You&apos;ll then have the libraries you need. Do no append the port number to the host name.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh6m7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>13871</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>