delphi - 使用 Indy 创建 TCP TUNNELING 系统

标签 delphi tcp proxy indy

您好,是否可以创建充当 tcp 代理服务器的中间应用程序?它将由两个组件组成。 IdTCPServer 和 IdTCPClient。想法是:

Application > 连接到 IdTCPServer > 所有数据都被重定向到 > IdTCPClient 连接到目标。

并且TCPClient收到的数据会重定向到IdTCPServer和Application。 我做了这么简单的应用程序,它在 HTTP 请求中工作,但是当我尝试将它用于 RDP 客户端时它失败了(我收到协议(protocol)错误的错误消息)。有可能吗?我使用 ReadByte 方法,每个字节都发送到另一个 IOHandler。

我想创建某种允许通过 NAT 连接的虚拟 TCP channel 。

我说的不够清楚。我想要实现的是这样的:

RDP 服务器 < IdTCPClient <> IdTCPclient > NAT > IdTCPServer < RDPClient.

最佳答案

Application > connects to IdTCPServer > all data is redirected to > IdTCPClient which is connected to the destination.

And the data received by TCPClient will be redirected to the IdTCPServer and Application.

事实上,Indy 有一个专门用于此目的的组件 - TIdMappedPortTCP

设置它的MappedHostMappedPort属性指向预期的目的地,然后激活它,所有入站连接将自动定向到目的地,并传回数据在两个方向上来回。

关于delphi - 使用 Indy 创建 TCP TUNNELING 系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36697488/

相关文章:

java - 如何让 HttpURLConnection 使用代理?

java - 从基于配置的服务 bean 切换到基于注释的服务 bean 时的 TransactionProxyFactoryBean

delphi - 获取图像的平均颜色

delphi - 如何使用 TFontDialog 设置中等粗细字体?

tcp - 为什么 TCP 的三向握手在确认时会撞到序列号?

Android VpnService - 如何转发拦截的互联网流量?

Delphi - 在Excel中添加特殊字符

Delphi:需要时提示 UAC 提升

python - Websockify 错误 - 地址已在使用中

javascript - Nodejs,观察类字段的变化