Is Delphi TClientSocket (still) deprecated?
In the resolution comments for bug report 12266 ("Error on socket connect causes resource leak"), Robert Ehteshamzadeh wrote
TClientSocket is deprecated. This r开发者_开发技巧eport is left open to allow for suggested workarounds.
This was for Delphi 6. In later versions, TClientSocket and TServerSocket have not been installed in the Tool palette by default, but an installation instruction was provided.
Has this status changed since then, so that TClientSocket (and TServerSocket too) are now first-class members in the Delphi VCL again? I would like to use TClientSocket (as another TCP/IP library after Indy and Synapse) in some projects and could not find an official status information in the Embarcadero DocWiki.
(An official index of 'deprecated' classes / methods would be useful).
To answer your question specifically:
Yes, TClientSocket and TServerSocket are still deprecated, and I can't imagine that this situation will change.
TClientSocket and TServerSocket use ineffective design based on Windows messages. This scheme was introduced in Windows 3.11 (or did it happen in 3.1?), when there was no true multitasking and multithreaded socket handling was impossible. Deprecation took place due to more powerful and high-performing solutions appeared on the component market (namely Indy, then other libraries). There's no sense to bring the old technology back to life though the components are still shipped. Moreover, I'd suggest Embarcadero to include some IOCP-based server socket implementation to be included, however, I guess server sockets are not in the scope of interest for Embarcadero now.
Well, it depends on what you call deprecated. If "no longer included in any of the source folders" counts as being deprecated, then yes, it is still deprecated (D2009).
Update
The source for TClientSocket and TServerSocket is actually present. @mjn and @Eugene pointed me towards it. Just goes to show once again that not finding something with Windows search doesn't mean it isn't there. It may just lurk in a file with an extension that Windows considers "un-search-able" because a search filter has not been defined for it... (Thought I had it set up for .pas files, but turns out that was on another of my machines).
But I guess that doesn't detract from it still being deprecated...
精彩评论