Skip to main content
Summary When compiling in C there are two winsock header files: winsock.h and winsock2.h. They seem to contain some common functions. Which one to use?
Article Number 26000
Environment Orbix 3.3 SP10 All supported platforms
Question/Problem Description When compiling in C there are two winsock header files: winsock.h and winsock2.h.  They seem to contain some common functions.  Which one to use?  If they are both present there are lots of errors during compilation.
Clarifying Information
Error Message
Defect/Enhancement Number
Cause There are updated API's like Bluetooth support, IPv6 support and more in the winsock2.h header.  The reason Microsoft  continues to ship the old winsock.h is, probably among other things, to allow development for a platform that doesn't support winsock2.
Resolution Use winsock2.h.  It is the latest one.  Use the flag #define WIN32_LEAN_AND_MEAN before the windows.h section in the Corba.h file
Workaround
Notes Microsoft mentions the need for the flag when using winsock 2: http://msdn.microsoft.com/en-us/library/ms737629(v=vs.85).aspx
Attachment
Created date: 21 October 2011
Last Modified: 13 February 2013
Last Published: 12 May 2012
First Published date: 21 October 2011

#Orbix
#KnowledgeDocs