Wiki:Delphi 第 3 方 TCP/IP 组件库的最新技术

发布于 2024-11-02 00:46:11 字数 413 浏览 6 评论 0原文

我已经大约 18 个月没有做裸机 TCP/IP 了,所以我想知道当前的技术水平如何。

我正在寻找服务器和客户端软件开发的积极和消极方面。
我将做一个需要坚如磐石的 TCP/IP 层的项目,所以对我来说这是一个重要的方面:)

为了使其成为一个社区 wiki,我正在寻找更广泛的答案,而不仅仅是“坚如磐石”。因此,例如有关特征宽度的信息也是值得赞赏的。

我将使用答案中找到的相关方面来更新问题,以便获得对这些库有平衡概述的 wiki 条目。

例如,请参阅下面我的回答以及我过去在印地的经历 我对 Indy 中的异常处理和防冻结持矛盾态度,虽然已经习惯了,但还是感觉有些不自然。

现在我使用 Delphi 2007(非 Unicode)和 XE(Unicode)进行开发,因此我正在考虑的库应该至少支持这两个 Delphi 版本。

I've not been doing bare metal TCP/IP for about 18 months, so I wonder what the current state of the art is.

I'm looking for both positive and negative aspects, with development of both server and client software.
I will be doing a project that needs a rock-solid TCP/IP layer, so for me that is an important aspect :)

For this to become a community wiki, I'm looking for broader answers than just 'rock solid'. So for instance information about the feature-width is also appreciated.

I'll be updating the question with relevant aspects found in the answers in order to get a wiki entry that has a balanced overview of those libraries.

For example, see my answer below with my past experience with Indy
I'm ambivalent on the exception handling and anti-freeze in Indy, though I got used to it, it still felt somewhat unnatural.

Right now I develop in both Delphi 2007 (non Unicode) and XE (Unicode), so the libraries I'm considering should support at least those two Delphi versions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

蛮可爱 2024-11-09 00:46:11

编辑:我过去使用 Indy 的经验总结以及评论(感谢 Eugene< /a>, Marjan)
(请更新当前 Indy 的最新技术):

Pro:

  • 随 Delphi
  • 成熟的
  • 开发社区
  • 开源一起提供,因此有很多眼睛仔细审查这些源代码
  • 中的大量有价值的注释文档
  • OpenSSL
  • 支持一系列广泛的 Delphi 版本(包括 2007 和 XE)
  • 协议的广泛选择

缺点:

  • Delphi 附带的版本并不总是最稳定的;通常需要从源下载才能获得稳定的构建
  • (同时)现在 Delphi 中存在大量重复代码(但 Indy 需要与旧的 Delphi 版本兼容),
  • 并非所有 TCP/IP 组件都是最新的 -日期(例如,当时 POP3 客户端组件不支持一些基本的 POP3 命令)
  • 版本互操作性很痛苦:从一个 Indy 版本升级到另一个版本可能非常耗时
  • 我对异常处理和防冻结持矛盾态度印地,虽然已经习惯了,但还是感觉有些不自然。
  • 构建更新之间进行了重大更改;需要 ifdef 来适应那些
  • 不清楚的发布状态(如果有的话)、长时间没有 RC、获取主干可能会使您的本地副本不稳定

Edit: Summary of my past experience with Indy, and the comments (thanks Eugene, Marjan)
(please update with the current Indy state of the art):

Pro:

  • ships with Delphi
  • mature
  • development community
  • open source so lots of eyes scrutinizing those sources
  • a truckload of valuable comment documentation in the source code
  • OpenSSL support
  • supports a broad set of Delphi versions (including 2007 and XE)
  • wide choice of protocols

Con:

  • the version shipping with Delphi was not always the most stable one; download from the sources was usually required to get a stable build
  • (in the mean time) lots of duplication of code that now is in Delphi (but Indy requires for compatibility with older Delphi versions)
  • not all TCP/IP components were up-to-date (for instance, back then the POP3 client component did not support some basic POP3 commands)
  • version interoperability was a pain: upgrading from one Indy version to another could be very time consuming
  • I'm ambivalent on the exception handling and anti-freeze in Indy, though I got used to it, it still felt somewhat unnatural.
  • breaking changes are made between build updates; ifdefs required to accommodate those
  • Unclear release status if any at all, no RCs for a long while, getting trunk can make your local copy unstable
み格子的夏天 2024-11-09 00:46:11

ICS - 互联网组件套件

ICS - 请参阅 www.overbyte.be。由 François Piette 开源。对我来说,这一直是印地的第一选择。这是最有趣的卖点:它使使用异步东西变得容易,并且异步似乎更接近“裸机”套接字编程。

我用它构建了一个相当复杂的 VNC 代理,其中代理本身(服务器)是使用 ICS 构建的,而客户端是 Indy 和 ICS 的混合体。在高需求时期,代理可以处理大约 100 个同时连接和大约 10 个同步 VNC 屏幕会话。它平均消耗 5 Mbit/s,处理两个不同互联网连接上的连接。我不认为 100 + 10 是极限,因为服务器处理这个问题没有任何问题,而且 CPU 使用率太低了。

优点:

  • 异步工作
  • 对初学者来说更容易,因为它不需要线程
  • 支持大量协议

缺点:

  • 依赖 Windows 消息传递。我对此感到不舒服。
  • 异步行为使得大多数协议的实现都有些困难(因为大多数协议都是发送命令 / 接收响应的形式)。这对于大多数人来说并不重要,因为 ICS 为最常用的协议提供了现成的实现。

话虽这么说,我已经很长时间没有使用 ICS 了,我不太了解所有的花哨功能。这是CW,所以请编辑和扩展!

ICS - The Internet Component Suite

ICS - see www.overbyte.be. Open source by François Piette. To me this has always been the number 1 alternative to Indy. It's most interesting selling point: it makes using asynchronous stuff easy, and being async seems to be closer to "bare metal" sockets programming.

I've used it to build a fairly complex VNC proxy where the proxy itself (server) is built with ICS and the clients are a mixture of Indy and ICS. In periods of high demand the proxy handles about 100 simultaneous connections and about 10 simultaneous VNC screen sessions. It eats up an average of 5 mbit/s, handles connections over two distinct Internet connections. I don't think the 100 + 10 is the limit, because the server handles that without any problems and CPU usage is too low to mention.

Pros:

  • Works asynchronously
  • Somewhat easier on beginners because it doesn't need threads
  • Supports a good number of protocols

Cons:

  • Relies on Windows messaging. I'm simply not comfortable with that.
  • The async behavior makes implementing most protocols slightly difficult (because most protocols are in the form of send command / receive response). This shouldn't matter for most people since ICS offers ready-made implementation for the most-used protocols.

All that being said, I haven't used ICS in a very long time, I'm not up-to-date with all the bells and whistles. This is CW, so please edit and expand!

暮年 2024-11-09 00:46:11

我自 2003 年起就使用 Indy 作为我自己的 TCP 通信框架。它坚如磐石,我有一个与 Delphi 2007 一起使用的版本,另一个与 Delphi 2010 一起使用的版本,如果正确处理线程,则无需使用防冻东西,并且我在客户端和服务器上具有一致的异常处理通过实现我自己的包装器来解决这个问题。

您可以在此处下载 (http://www.csinnovations.com/framework_delphi.htm) -查找Tcp单元,主要是AppTcpServerUnt和AppTcpClientUnt。

I have used Indy since 2003 for my own TCP communications framework. It is rock-solid, I have a version used with Delphi 2007 and another with Delphi 2010, if you handle the threadng correctly there is no need to use the anti-freeze stuff, and I have consistent exception handling on the client and the server by implementing my own wrapper around this.

You can dowload it here (http://www.csinnovations.com/framework_delphi.htm) - look for the Tcp units, mainly AppTcpServerUnt and AppTcpClientUnt.

孤寂小茶 2024-11-09 00:46:11

我强烈推荐 Clever Internet Suite,它是迄今为止设计和编写得最好的通信组件集。它不是免费的,因此不太出名,但非常值得研究。

优点:

  • 精心设计和编写,
  • 包含许多组件并实现各种协议。
  • 支持广泛的 Delphi 版本(包括 2007 和 XE)
  • SSL 支持
  • 成熟产品如 发布历史 表示

Con:

  • 不开源

I would strongly recommend Clever Internet Suite, it's by far the best designed and written set of communication components. It's not free and so not that well known, but it's well worth investigating.

Pro:

  • well designed and written
  • contains many components and implements various protocols.
  • supports a broad set of Delphi versions (including 2007 and XE)
  • SSL support
  • mature product as the release history indicates

Con:

  • not open source
思念绕指尖 2024-11-09 00:46:11

您可以考虑使用更高级别的协议,例如 HTTP,因为:

  • 它对防火墙和 VPN 更友好;
  • 它有完善的文档记录并被称为良好的协议;
  • 已经有安全的HTTPS版本;
  • 与行 TCP/IP 相比,它的开销非常低;
  • 它可以在 AJAX 环境中使用(如果您将来需要它);
  • Microsoft 已经在现代版本的 Windows 中为您进行了低级调整。

在这种情况下,您可以查看来自 Delphi 的两个开源类 6 至 XE:

THttpApiServer,它使用快速 http.sys 内核模式服务器实现 HTTP 服务器:

  • HTTP 服务器 API 使应用程序能够通过 HTTP 进行通信,而无需
    使用 Microsoft Internet 信息服务器 (IIS)。应用程序可以注册
    接收特定 URL 的 HTTP 请求、接收 HTTP 请求并发送
    HTTP 响应。 HTTP 服务器 API 包括 SSL 支持,以便应用程序
    无需 IIS,即可通过安全 HTTP 连接交换数据。这也是
    设计用于与 I/O 完成端口配合使用。
  • Windows Server 2003 操作系统支持 HTTP Server API
    以及带有 Service Pack 2 (SP2) 的 Windows XP。请注意,Microsoft IIS 5
    在带有 SP2 的 Windows XP 上运行无法与其他 HTTP 共享端口 80
    同时运行的应用程序。

TWinHTTP 使用 WinHTTP API 处理客户端 HTTP/1.1 请求:

  • Microsoft Windows HTTP Services (WinHTTP) 面向中间层和
    需要访问 HTTP 客户端堆栈的后端服务器应用程序;
  • 比旧的 WinINet API 快得多。

由此产生的速度非常好(尤其是服务器),并且您将依赖于 Microsoft 的实现。第一个是 IIS 的核心,第二个用于最新版本的 Internet Explorer。

You could consider using a higher protocol level like HTTP, because:

  • It's more firewall and VPN friendly;
  • It's well documented and known as a good protocol;
  • It already has secured HTTPS version;
  • It has a very low overhead over row TCP/IP;
  • It's ready to use in an AJAX environment (if you need it in the future);
  • Microsoft already did the low-level tuning for you in modern version of Windows.

In this case, you could take a look at two Open Source classes working from Delphi 6 up to XE:

THttpApiServer which implements a HTTP server using fast http.sys kernel-mode server:

  • The HTTP Server API enables applications to communicate over HTTP without
    using Microsoft Internet Information Server (IIS). Applications can register
    to receive HTTP requests for particular URLs, receive HTTP requests, and send
    HTTP responses. The HTTP Server API includes SSL support so that applications
    can exchange data over secure HTTP connections without IIS. It is also
    designed to work with I/O completion ports.
  • The HTTP Server API is supported on Windows Server 2003 operating systems
    and on Windows XP with Service Pack 2 (SP2). Be aware that Microsoft IIS 5
    running on Windows XP with SP2 is not able to share port 80 with other HTTP
    applications running simultaneously.

TWinHTTP which handles client-side HTTP/1.1 request using the WinHTTP API:

  • Microsoft Windows HTTP Services (WinHTTP) is targeted at middle-tier and
    back-end server applications that require access to an HTTP client stack;
  • Is much faster than older WinINet API.

Resulting speed is very good (especially the server), and you will rely on Microsoft implementation. The first is the core of IIS, and the second is used in the latest versions of Internet Explorer.

许久 2024-11-09 00:46:11

答案实际上取决于许多因素和您的要求,例如

  1. 需要哪些层(TCP、SSL/TLS、应用程序级协议),
  2. 您是否需要客户端或服务器(服务器是更复杂的任务),
  3. 无论您是否计算付费选项。

一般来说,18 个月甚至 3 年内并没有发生太多(积极的)事情,因为大多数开发人员将 .NET 视为主要开发平台。

其他答案中提到的 Clever Internet SuiteDevArt 的 SecureBridge 获得了一些新功能。

我们的 SecureBlackbox 提供对最高级功能(除了本机 SSL/TLS 之外)的支持:IPv6、HTTPS 代理基本、摘要和 NTLM 身份验证(从 SecureBlackbox 9 开始)、国际域名(从 SecureBlackbox 9 开始)、DNSSEC、带宽控制等。

SecureBlackbox 支持的应用程序级协议有 HTTP(客户端和服务器)、WebDAV(客户端和服务器)、FTP(客户端和服务器)、SSH 和 SFTP(客户端和服务器)、SMTP 和 POP3 客户端、DNS 客户端、AS2 和 AS3。所有协议(当然除了 SSH 和 SFTP)都完全支持 SSL/TLS。

支持的协议列表可以在软件包页面上找到。每个包的技术规格页面上列出了支持的协议功能。

The answer really depends on many factors and your requirements, such as

  1. what layers are needed (TCP, SSL/TLS, application-level protocols)
  2. whether you need a client or a server as well (server is much more complicated task)
  3. whether you count paid options.

In general, not much (positive) happened in 18 months or even in 3 years as most developers look at .NET as primary development platform.

Clever Internet Suite mentioned in other answer and DevArt's SecureBridge gained some new functionality.

Our SecureBlackbox offers support for the most advanced features (besides native SSL/TLS): IPv6, HTTPS Proxy with basic, digest and NTLM authentication (starting with SecureBlackbox 9), International Domain Names (starting with SecureBlackbox 9), DNSSEC, bandwidth control and more.

Application-level protocols supported by SecureBlackbox are HTTP (client and server), WebDAV (client and server), FTP (client and server), SSH and SFTP (client and server), SMTP and POP3 clients, DNS client, AS2 and AS3. All of the protocols (besides SSH and SFTP, of course) have complete support for SSL/TLS.

The list of supported protocols can be found on Packages page. Supported protocol features are listed on Technical Specification page for each package.

别在捏我脸啦 2024-11-09 00:46:11

在旧的 Delphi 版本(2!3!4!)中以 NetMaster 组件的方式(方式!)

与 Indy 一起工作,但也有不自然的感觉(实际上我更愿意将其描述为笨重)

偶然发现 Synapse 当我正在寻找围绕 Windows 网络 API 的轻量级包装器时,

然后重新发现普通的旧 TTcpClient/TTcpServer。它们是 Delphi 自己的winsock 包装器!我使用它们来阻塞,每个 TTcpClient 都有一个专用的 TThread 继承,并让 TTcpServer 执行线程并完成 DoAccept 中的所有工作,请参阅 此处 为例。

现在,这给了我我们正在寻找的坚如磐石的感觉。如果您想支持重负载,我会尝试构建一个线程管理器,它可以处理每个线程的多个套接字/连接,或者有两组线程:一组监听大量的“休眠”连接,另一组则处理较少的“活动”连接,根据是否正在处理请求或响应来切换线程之间的连接。 (例如 HTTP 的Connection: keep-alive

Worked with NetMaster components way (way!) back in the old Delphi versions (2! 3! 4!)

Did some work with Indy, but had the unnatural feeling also (actually I'd describe it more as bulky)

Stumbled upon Synapse when I was searching for just a light wrapper around the Windows network API,

And then rediscovered plain old TTcpClient/TTcpServer. They are Delphi's own wrapper around winsock! I use them blocking, with a dedicated TThread inheritant for each TTcpClient, and let TTcpServer do the threads and do all the work in DoAccept, see here for an example.

This, fow now, gave me the rock-solid feel we're looking for. If you want to support heavy load, I would try and build a thread manager that handles several sockets/connections per thread, or have two sets of threads: a few that listen a larger number of 'dormant' connections, and the others that handle lesser 'active' connections, switching connections between the threads depending on wether a request or response is being handled. (e.g. HTTP's Connection: keep-alive)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文