Delphi IdTCPClient[1] 介绍、属性、方法
Delphi IdTCPClient[1] 介绍、属性、方法
1、介绍
实现TCP客户端。TIdTCPClient封装了一个完整的TCP(传输控制协议)客户端,包括socks支持。TIdTCPClient可以用作特定协议实现的祖先类。许多Indy客户端组件,如TIdDayTime、TIdEcho、TIdFinger、TIdFTP、TIdGopher、TIdPHTTP、TIdNNTP、TIdPOP3、TIdQUOT、TIdSMTP、TIdTelnet和TIdWhois都是TIdTCPClient的后代
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | unit IdTCPClient; interface uses Classes, IdStack, IdException, IdGlobal, IdTCPConnection; const BoundPortDefault = 0 ; type TIdTCPClient = class (TIdTCPConnection) protected FBoundIP: string ; FBoundPort: Integer ; FBoundPortMax: Integer ; FBoundPortMin: Integer ; FHost: string ; FOnConnected: TNotifyEvent; FPassword: string ; FPort: integer ; FUsername: string ; // procedure SetHost( const Value: string ); virtual; procedure SetPort( const Value: integer ); virtual; procedure DoOnConnected; virtual; // property Username: string read FUsername write FUsername; property Password: string read FPassword write FPassword; public procedure Connect( const ATimeout: Integer = IdTimeoutDefault); virtual; function ConnectAndGetAll: string ; virtual; constructor Create(AOwner: TComponent); override; destructor Destroy; override; // property BoundPortMax: Integer read FBoundPortMax write FBoundPortMax; property BoundPortMin: Integer read FBoundPortMin write FBoundPortMin; published property BoundIP: string read FBoundIP write FBoundIP; property BoundPort: Integer read FBoundPort write FBoundPort default BoundPortDefault; property Host: string read FHost write SetHost; property OnConnected: TNotifyEvent read FOnConnected write FOnConnected; property Port: integer read FPort write SetPort; end ; implementation uses IdComponent, IdIOHandlerSocket, IdResourceStrings, SysUtils; |
2、属性:
- BoundIP
- BoundPort
- BoundPortMax
- BoundPortMin
- Host
- OnConnected
- Port
TIdTCPConnection
- ASCIIFilter
- ClosedGracefully
- Greeting
- InputBuffer
- Intercept
- IOHandler
- LastCmdResult
- MaxLineAction
- MaxLineLength
- OnDisconnected
- OnWork
- OnWorkBegin
- OnWorkEnd
- ReadLnSplit
- ReadLnTimedOut
- ReadTimeout
- RecvBufferSize
- SendBufferSize
- Socket
TIdComponent
- LocalName
TIdBaseComponent
- Version
3、方法
TIdTCPClient
- Connect
- ConnectAndGetAll
- Create
- Destroy
TIdTCPConnection
- AllData
- CancelWriteBuffer
- procedure Capture(ADest: TStream; const ADelim: string = '.'; const AIsRFCMessage: Boolean = True); overload;
- procedure Capture(ADest: TStream; out VLineCount: Integer; const ADelim: string = '.'; const AIsRFCMessage: Boolean = True); overload;
- procedure Capture(ADest: TStrings; const ADelim: string = '.'; const AIsRFCMessage: Boolean = True); overload;
- procedure Capture(ADest: TStrings; out VLineCount: Integer; const ADelim: string = '.'; const AIsRFCMessage: Boolean = True); overload;
- CheckForDisconnect
- CheckForGracefulDisconnect
- CheckResponse
- ClearWriteBuffer
- CloseWriteBuffer
- Connected
- Create
- CurrentReadBuffer
- Destroy
- Disconnect
- DisconnectSocket
- FlushWriteBuffer
- GetInternalResponse
- function GetResponse(const AAllowedResponses: array of SmallInt): SmallInt; virtual; overload;
- function GetResponse(const AAllowedResponse: SmallInt): SmallInt; overload;
- InputLn
- OpenWriteBuffer
- procedure RaiseExceptionForLastCmdResult; virtual; overload;
- procedure RaiseExceptionForLastCmdResult(AException: TClassIdException); virtual; overload;
- ReadBuffer
- ReadCardinal
- ReadChar
- ReadFromStack
- ReadInteger
- ReadLn
- ReadLnWait
- ReadSmallInt
- ReadStream
- ReadString
- ReadStrings
- function SendCmd(const AOut: string; const AResponse: SmallInt = -1): SmallInt; overload;
- function SendCmd(const AOut: string; const AResponse: Array of SmallInt): SmallInt; virtual; overload;
- WaitFor
- Write
- WriteBuffer
- WriteCardinal
- WriteFile
- WriteHeader
- WriteInteger
- WriteLn
- WriteRFCReply
- WriteRFCStrings
- WriteSmallInt
- WriteStream
- WriteStrings
TIdComponent
- BeginWork
- Create
- Destroy
- DoWork
- EndWork
TIdBaseComponent
- GetVersion
4、事件
- OnStatus //OnStatus是当前连接状态更改时触发的TIdStatusEvent事件处理程序。OnStatus由DoStatus方法触发,该方法提供事件处理程序使用的参数。axStatus是当前连接的TIdStatus值。aaArgs是Format函数的可选参数,用于构造表示当前连接状态的文本消息。
创建时间:2022.11.21 更新时间:
博客园 滔Roy https://www.cnblogs.com/guorongtao 希望内容对你有所帮助,谢谢!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?