Delphi IdTCPClient[1] 介绍、属性、方法
1、介绍
实现TCP客户端。TIdTCPClient封装了一个完整的TCP(传输控制协议)客户端,包括socks支持。TIdTCPClient可以用作特定协议实现的祖先类。许多Indy客户端组件,如TIdDayTime、TIdEcho、TIdFinger、TIdFTP、TIdGopher、TIdPHTTP、TIdNNTP、TIdPOP3、TIdQUOT、TIdSMTP、TIdTelnet和TIdWhois都是TIdTCPClient的后代
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 更新时间:
标签:const,string,read,Delphi,overload,IdTCPClient,Integer,procedure,属性 From: https://www.cnblogs.com/guorongtao/p/16910688.html