What is the difference between TTcpClient / TTcpServer and TClientSocket / TServerSocket?
They are NOT the same and they do NOT work the same. They use very different approaches to API socket communication, event handling, error handling, etc.
TClientSocket
and TServerSocket
are the original VCL-based socket components (Windows). They were deprecated in Delphi 7 and are no longer installed by default, but are still available for manual installation if you wish to use them.
TTcpClient
and TTcpServer
were originally introduced in Delphi 6 as a cross-platform socket solution for Kylix (which is a dead product). They were removed from Delphi in XE6, downgraded to demo status, weren't even official components.
In my opinion, TTcpClient
and TTcpServer
are terrible components, you should stay away from them. They use a minimalist "least common demonstrator" approach to cross-platform programming, supporting only a few basic features supported by multiple platforms, rather than using any platform-specific features or even higher-level features. They have a very simple interface that is poorly designed. They are very difficult to work with, have poor error handling and are not very flexible to use.
If you need to write new socket code TClientSocket
and it TServerSocket
works great if you are only interested in Windows support, but if you need to support cross platform you should use a third party socket library like Indy ( TIdTCPClient
/ TIdTCPServer
), ICS ( TWSocket
/ TWSocketServer
), Synapse ( TTCPBlockSocket
) and etc.
source to share