哪位大哥能用Idtcpserver and idtcpclient 写个端口转发=端口映射=数据转发我在网络上搜了好久了也没找到啊 我不想用indy自带的那个转发控件 我想转发的同时数据加密
解决方案 »
- 我做的将EXCEL数据与ACCESS数据比较
- 小问题-------------------这个判断语句如何写?
- 民币2000请高手修改2个程序,要求非常熟悉WINDOWS内核编程
- --高手路过不要错过:打印Word斜线表头难题
- 暑假了,想找个兼职做做???最好关于Delphi数据库开发的??当然最好SOHO。
- delphi7的code_complete用不了了,请帮忙
- 怎么让DBgrid中title上面的字靠中间对齐?(在线)
- 如何在程序中定义和使用记录(RECORD)?急!!!
- 怎么判断NoteBook某一Page上的控件的数目?
- 如何将本地(win98)端的SQL库与NT上的库关连?
- D2007+ics 发送邮件,出现乱码情况,见内
- DELPHI bpl 的 问题
可以简单写个例子么?发给我么?
type
TMySuperMappedPortContext = Class(TIdMappedPortContext)
public
procedure DoEncode;
procedure DoDecode;
End;
implementation{自定义加密函数}
function EncodeData(Src: String): String;
begin
Result := Src;
end;{自定义解密函数}
function DecodeData(Src: String): String;
begin
Result := Src;
end;
{自定义加密接口}
procedure TMySuperMappedPortContext.DoEncode;
begin
FNetData := EncodeData(FNetData);
end;{自定义解密接口}
procedure TMySuperMappedPortContext.DoDecode;
begin
FNetData := DecodeData(FNetData);
end;
{OnBeforeListenerRun事件}
{替换相应的映射消息处理类型}
procedure TForm1.IdMappedPortTCP1BeforeListenerRun(AThread: TIdThread);
begin
IdMappedPortTCP1.ContextClass := TMySuperMappedPortContext;
end;{OnExecute事件}
{接收到须转发的数据,调用DoEncode进行"加密"}
procedure TForm1.IdMappedPortTCP1Execute(AContext: TIdContext);
begin
if AContext is TMySuperMappedPortContext then begin
TMySuperMappedPortContext(AContext).DoEncode;
end;
end;{OnOutboundData事件}
{接收到须转发的数据,调用DoDecode进行"解密"}
procedure TForm1.IdMappedPortTCP1OutboundData(AContext: TIdContext);
begin
if AContext is TMySuperMappedPortContext then begin
TMySuperMappedPortContext(AContext).DoDecode;
end;
end;