c++c++builderc++builder-2010tclientsocket

Why are TClientSocket and TServerSocket deprecated and what should I use instead?


I'm just starting to get familiar with Embarcadero RAD Studio 2010 after living a life of Eclipse, Emacs, Visual Studio and notepad :)

I'm jumping into quite a large C++ application (500.000 - 1.000.000 lines) that I found made extensive use of TClientSocket and TServerSocket. The IDE first complanied about that TClientSocket was not found but could still compile and I scratched my head. Then I found out that it's not installed by default anymore and is marked as deprecated since way back.

I have tried to read about the subject but haven't found much information. My questions are


Solution

  • Deprecated because not supported any more. They are a wrap up of Winsock sockets, so the overall internal mechanism is the same - 'Create listener, listen, accept, create a client handler thread, passing it the ServerClientSocket, client thread reads and writes streams'.

    You could maybe try just importing the components - if you have a massive legacy app to support, then this is surely the way to go if it works.

    Then there's the other way :(( Use Indy or Synapse components to build 'TClientSocket' and TServerSocket' classes with identical members so that the legacy app will work without massive changes.