indy问题(50分)

  • 主题发起人 主题发起人 linuxping
  • 开始时间 开始时间
L

linuxping

Unregistered / Unconfirmed
GUEST, unregistred user!
indy中的TIdIOHandler类在IdIOHandler.pas单元中,
但IdIOHandler确是一个空类(应为函数都是空的,相当于是虚函数吧),
但是, TIdTCPConnection等类却使用了TIdIOHandler类:
TIdTCPConnection = class(TIdComponent)
protected
FASCIIFilter: boolean;
// TODO - Change the "move" functions to read write functinos. Get as much as possible down
// to just TStream so we can replace it easily
FClosedGracefully: Boolean;
FGreeting: TIdRFCReply;
FFreeIOHandlerOnDisconnect: Boolean;
FInputBuffer: TIdManagedBuffer;
FIntercept: TIdConnectionIntercept;
FIOHandler: TIdIOHandler; <--------------------
.......
那么,TIdIOHandler在哪里被覆盖了呢?
 
看看 FIOHandle 在构建时,是否采用了如: FIOHandle := TIdxxxxIOHandle.Create();
如果是,则 TIdxxxxIOHandle 就是其真正的实例类。
 
在Indy网站http://www.indyproject.org/KB/上有写到

How do I use a TIdTCPClient with a SOCKS Proxy?
For Indy 9.0
1. Create an IOHandler such as TIdIOHandlerSocket or TIdSSLIOHandlerSocket and assign the TCPClient.IOHandler property this.
2. Create a TIdSocksInfo object and assign it to the IOHandler's SocksInfo property.
3. Set the TIdSocksInfo properties as required.

看来,是TIdIOHandlerSocket or TIdSSLIOHandlerSocket 覆盖了它
 
后退
顶部