您好,是否可以创建充当 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
。
设置它的MappedHost
和MappedPort
属性指向预期的目的地,然后激活它,所有入站连接将自动定向到目的地,并传回数据在两个方向上来回。
关于delphi - 使用 Indy 创建 TCP TUNNELING 系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36697488/