Hi there,
I am building a small tcp ip clent server application using RAD 10.3, VCL and c++ for Windows.
Could someone please advise how I go about including winapi.winsock2 libraries into my application? From my reading that is the library I need to include for network programming. I gather it's not simply including the #include preprocessor statement at the top of my header/class file?
Thanks,
Tony
RAD 10.3 c++
Moderator: 2ffat
Re: RAD 10.3 c++
WinSock is Windows' core networking API, but why would you want to use the API directly instead of using a higher-level wrapper, like Indy (which is pre-installed in the IDE), ICS, Synapse, etc? It is a lot of work to use WinSock directly, you should let the wrappers do the hard work for you.Tony2020 wrote:Could someone please advise how I go about including winapi.winsock2 libraries into my application? From my reading that is the library I need to include for network programming.
If you want to use the WinSock API directly, then yes, you would simply add "#include <winsock2.h>" to your C++ code, as well as add a linker reference to "ws2_32.lib", either by adding that .lib file to your project, or by adding a "#pragma comment(lib, ws2_32.lib)" statement to your C++ code. Since you are using C++, you are better off using Microsoft's WinSock API definitions directly from "winsock2.h" instead of using C++Builder's "Winapi.Winsock2.hpp" header.Tony2020 wrote:I gather it's not simply including the #include preprocessor statement at the top of my header/class file?
Remy Lebeau (TeamB)
Lebeau Software
Lebeau Software