我的一片天

我的一片天
posts - 27, comments - 12, trackbacks - 0, articles - 16
   :: 首页 :: 新随笔 :: 联系 ::  :: 管理

Indy10中IdMappedPortTCP的用法

Posted on 2009-04-17 00:03 xyz 阅读(1542) 评论(0)  编辑 收藏 引用 所属分类: Delphi

Indy10把参数由AThread换成AContext后,用法已经不同.

OnConnect中获取来源IP
AContext.Connection.Socket.Binding.PeerIP;

OnExecute中处理客户端来的数据
Var
aThread:TIdMappedPortContext;
s:string;
begin
   aThread:=TIdMappedPortContext(aContext);
   s:=aThread.netdata;
  //.....(处理过程)

end;

OnOutboundData中处理服务端过来的数据
Var
 aThread:TIdMappedPortContext;
 s:string;
begin
  aThread:=TIdMappedPortContext(aContext);
  s:=aThread.netdata;
  //.....
end;

只有注册用户登录后才能发表评论。