RAD 10.3 c++

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Post Reply
Tony2020
Posts: 1
Joined: Thu Jan 02, 2020 5:24 pm

RAD 10.3 c++

Post by Tony2020 »

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
rlebeau
BCBJ Author
BCBJ Author
Posts: 1709
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA
Contact:

Re: RAD 10.3 c++

Post by rlebeau »

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.
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:I gather it's not simply including the #include preprocessor statement at the top of my header/class file?
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.
Remy Lebeau (TeamB)
Lebeau Software
Post Reply