Monday, March 22, 2010

Indy or TClientSocket/TServerSocket?

Recently I had to develop a client-server application(in Delphi of course), nothing out of the ordinary, but as always, when I have this task, I'm frozed for a few minutes trying to answer the question "which components should I use? Indy or TClientSocket and TServerSocket?".
Maybe for some of you there's no problem choosing but for me it is, here is why:
- I work in Delphi 7, using Indy it's going to be a bumpy ride when upgrading to Delphi 2010(or Delphi 2011?), because Indy has changed a lot(the arhitecture).
- Indy is notifying itself using exceptions(client's hate exeptions/errors and so do we)
- TClient/ServerSocket: are very flexible, basically a wrapper for Windows socket methods found in WinSock.pas unit.
- TClient/ServerSocket: can be used in Blocking and Non-Blocking mode(read help for further information)
- TClient/ServerSocket: can easily cooperate with threads
- TClient/ServerSocket: stopping the server will NOT raise exceptions if there are clients connected, they simply get disconnected.
- TClient/ServerSocket: I can go on and on but I believe there are enough pro's for TClient/ServerSocket and enough downs for Indy that will make you do further investigations on this.

Let me know about your pro's and con's on this subject.
I am NOT saying that Indy is bad, it's just to lousy to use from my point of view, at least in Delphi 7 version.

P.S. for those of you who do not know, TClientSocket and TSererSocket do NOT appear in Internet tab on the component palette after installing Delphi 7, you must go to Components -> Install Packages... -> Add... -> browse to Delphi bin directory(default C:\Program Files\Borland\Delphi7\Bin -> type in file name "dclsockets70.bpl" and hit enter(return) key press OK and now you have successfully installed the TClient/ServerSocket components.

6 comments:

  1. I wonder why TClientSocket and TSererSocket are not default options!
    Is there any known reason to hide them and force you to perform extra steps to enable them?

    ReplyDelete
  2. @Mariana most likely there was a mistake when they generated the installer...

    ReplyDelete
  3. always best to get lastest version before you start that way upgrading would not be so hard but for me personally i hate indy, and i noticed in last view new delphis the tclientsocket is not as stable as it use to be giving socket flow error's so on so personally i find ICS - Internet Component Suite by overbyte alot more stable and it supports all delphis just about.

    http://www.overbyte.be

    ReplyDelete
  4. I do NOT encourage third party components at anytime, yes TClientSocket/TServerSocket are pretty unstable, but Indy can do it's job also, once you get the hang of it...

    ReplyDelete
    Replies
    1. TClientSocket/TServerSocket are pretty unstable
      -- Delphi 7+ only or included in Delphi 6?

      Delete
  5. Or you can alternate Indy with Synapse.

    ReplyDelete

Blogroll(General programming and Delphi feeds)