[CDRIVER-290] Socket initialization problem Windows 7. Created: 16/Feb/14  Updated: 03/May/17  Resolved: 11/Mar/14

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 0.8.1
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Khalid Mahmood Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: Windows, connection, driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows 7, Visual Studio 2010


Attachments: Zip Archive mongo-c-driver-0.8.1_vs2010.zip    

 Description   

I was trying to build the driver on Windows 7 with scons build utility but I was not able to connect the database with the following lines of code.

mongo conn[1];
int status = mongo_client( conn, "127.0.0.1", 27017 );
if( status != MONGO_OK ) {
switch ( conn->err )

{ case MONGO_CONN_NO_SOCKET: printf( "no socket\n" ); return 1; case MONGO_CONN_FAIL: printf( "connection failed\n" ); return 1; case MONGO_CONN_NOT_MASTER: printf( "not master\n" ); return 1; }

}

I have traced the error receive MONGO_SOCKET_ERROR by tracing conn->err. I have then initialized the socket on env.c file around line# 500 with adding some code. Now it works perfectly fine.

To build the driver, I have avoided the scons and used a visual studio 2010 project. I am providing the working visual studio project here together with the codes that I have added. I have also used Preprocessor directive MONGO_USE__INT64 and MONGO_ENV_STANDARD.

Please note that the after compilation the output files will be in Debug folder which are mongo_driver.lib and mongo_driver.dll

This is also mentionable that the same driver both works fine for OS X 10.6 and Linux 64.



 Comments   
Comment by Christian Hergert [ 11/Mar/14 ]

Khalid,

Cloasing, please submit a pull request on github for any patches you have.

Thanks,

– Christian

Comment by Christian Hergert [ 01/Mar/14 ]

Hi Khalid,

Development on the 0.8 series of the driver has relatively subsided. However, we may be able to apply your changes to the legacy branch if you can provided is a patch/diff.

Thanks for your time,

– Christian

Generated at Wed Feb 07 21:09:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.