[ 
https://issues.apache.org/jira/browse/THRIFT-1433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13158554#comment-13158554
 ] 

Peace C edited comment on THRIFT-1433 at 11/28/11 9:54 PM:
-----------------------------------------------------------

Add alternate patch that uses ::bind for all platforms instead of #ifdef's for 
Windows vs Unix.

It would be great if this would be considered for inclusion in the 0.8 release. 
The Fix value is currently set for 0.9.
                
      was (Author: peace):
    Alternate patch that uses ::bind for all platforms instead of #ifdef
                  
> TServerSocket fix for MSVC
> --------------------------
>
>                 Key: THRIFT-1433
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1433
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.8
>         Environment: Windows Visual Studio 2010
>            Reporter: Peace C
>              Labels: TServerSocket,, bind,, socket,
>             Fix For: 0.9
>
>         Attachments: TServerSocket_bind.patch, 
> TServerSocket_bind_alternate.patch
>
>
> The changes to compile the Thrift library for Visual Studio #ifdef'd out the 
> bind section in TServerSocket.cpp. This prevented TSimpleServer, 
> TThreadedServer and anything that uses TServerSocket transport from 
> functioning.  The server side reports the following error due to 'bind' being 
> skipped:
> TSimpleServer::run() listen(): Could not listen: errno = 10022
> The bind overload unfortunately results in a conflict with Microsoft's 
> libraries. TServerSocket uses namespace std which pulls in the tr1 overloads 
> of bind. The template definitions seem to always 'win' over any other 
> overloads. I was unsuccessful creating an overload of bind in the windows 
> config.h file so had to #ifdef the bind call. Microsoft is aware of the issue:
> http://connect.microsoft.com/VisualStudio/feedback/details/500364/how-to-avoid-conflicts-between-tr1-bind-and-winsock-bind-function
> It does the job though I'm not too proud of using #ifdefs. One possible way 
> around this is to declare a wrapper function as such in config.h:
> inline int thriftbind(SOCKET socket, sockaddr* name, int namelen)
> {
>     return ::bind(socket, name, namelen);
> }
> The Unix-style version would need to be declared in the appropriate file as 
> well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to