首先,直接用IdMappedPortTCP做代理服务器是完全工作正常的
现在希望加密通信过程(无论DecodeData还是EncodeData,目前都只是一句OutputDebugString,输出封包信息
)
代码如下
procedure TForm1.IdMappedPortTCP1Execute(AContext: TIdContext);
begin
OutputDebugString(PChar(TIdMappedPortContext(AContext).NetData));
TIdMappedPortContext(AContext).NetData := DecodeData(TIdMappedPortContext(AContext).NetData);
end
procedure TForm1.IdMappedPortTCP1OutboundData(AContext: TIdContext);
begin
OutputDebugString(PChar(TIdMappedPortContext(AContext).NetData));
TIdMappedPortContext(AContext).NetData := EncodeData(TIdMappedPortContext(AContext).NetData);
end
现在问题如下
client发送的数据是通过了DecodeData 发送去了server。
server返回信息IdMappedPortTCP就没有收到了。
如果注释EncodeData或者DecodeData任何一个的调用,转发通信的过程又正常了。
请大家指点为什么会这样子?