?? wsocket.pas
字號:
property LocalPort : String read FLocalPortStr
write SetLocalPort;
property LocalAddr : String read FLocalAddr
write SetLocalAddr;
property Proto : String read GetProto
write SetProto;
property MultiThreaded : Boolean read FMultiThreaded
write FMultiThreaded;
property MultiCast : Boolean read FMultiCast
write FMultiCast;
property MultiCastAddrStr: String read FMultiCastAddrStr
write FMultiCastAddrStr;
property MultiCastIpTTL : Integer read FMultiCastIpTTL
write FMultiCastIpTTL;
property ReuseAddr : Boolean read FReuseAddr
write FReuseAddr;
property PeerAddr : String read GetPeerAddr;
property PeerPort : String read GetPeerPort;
property DnsResult : String read FDnsResult;
property DnsResultList : TStrings read FDnsResultList;
property State : TSocketState read FState;
property AllSent : Boolean read bAllSent;
property ReadCount : LongInt read FReadCount;
property RcvdCount : LongInt read GetRcvdCount;
property LastError : Integer read FLastError;
property ComponentOptions : TWSocketOptions read FComponentOptions
write FComponentOptions;
property BufSize : Integer read FBufSize
write FBufSize;
property SocketSndBufSize : Integer read FSocketSndBufSize;
property ListenBacklog : Integer read FListenBacklog
write FListenBacklog;
property ReqVerLow : BYTE read GetReqVerLow
write SetReqVerLow;
property ReqVerHigh : BYTE read GetReqVerHigh
write SetReqVerHigh;
property OnDataAvailable : TDataAvailable read FOnDataAvailable
write FOnDataAvailable;
property OnDataSent : TDataSent read FOnDataSent
write FOnDataSent;
property OnSendData : TSendData read FOnSendData
write FOnSendData;
property OnSessionClosed : TSessionClosed read FOnSessionClosed
write FOnSessionClosed;
property OnSessionAvailable : TSessionAvailable read FOnSessionAvailable
write FOnSessionAvailable;
property OnSessionConnected : TSessionConnected read FOnSessionConnected
write FOnSessionConnected;
property OnChangeState : TChangeState read FOnChangeState
write FOnChangeState;
{ property OnLineTooLong : TNotifyEvent read FOnLineTooLong
write FOnLineTooLong; }
property OnDnsLookupDone : TDnsLookupDone read FOnDnsLookupDone
write FOnDnsLookupDone;
property OnError : TNotifyEvent read FOnError
write FOnError;
property OnBgException : TBgExceptionEvent read FOnBgException
write FOnBgException;
property FlushTimeout : Integer read FFlushTimeOut
write FFlushTimeout;
property SendFlags : TSocketSendFlags read GetSendFlags
write SetSendFlags;
property Text: String read ReceiveStr
write SendText;
property LingerOnOff : TSocketLingerOnOff read FLingerOnOff
write FLingerOnOff;
property LingerTimeout : Integer read FLingerTimeout
write FLingerTimeout;
{$IFDEF DELPHI1}
property TrumpetCompability : Boolean read FTrumpetCompability
write FTrumpetCompability;
{$ENDIF}
property OnDisplay : TDebugDisplay read FOnDisplay
write FOnDisplay;
end;
TSocksState = (socksData, socksNegociateMethods, socksAuthenticate, socksConnect);
TSocksAuthentication = (socksNoAuthentication, socksAuthenticateUsercode);
TSocksAuthState = (socksAuthStart, socksAuthSuccess, socksAuthFailure, socksAuthNotRequired);
TSocksAuthStateEvent = procedure(Sender : TObject; AuthState : TSocksAuthState) of object;
TSocksErrorEvent = procedure(Sender : TObject; Error : Integer; Msg : String) of Object;
TCustomSocksWSocket = class(TCustomWSocket)
protected
FSocksState : TSocksState;
FSocksServer : String;
FSocksLevel : String;
FSocksPort : String;
FSocksPortAssigned : Boolean;
FSocksServerAssigned : Boolean;
FSocksUsercode : String;
FSocksPassword : String;
FSocksAuthentication : TSocksAuthentication;
FSocksAuthNumber : Char;
FBoundAddr : String;
FBoundPort : String;
FRcvBuf : array [0..127] of char;
FRcvCnt : Integer;
FSocksRcvdCnt : Integer;
FSocksRcvdPtr : PChar;
FOnSocksError : TSocksErrorEvent;
FOnSocksConnected : TSessionConnected;
FOnSocksAuthState : TSocksAuthStateEvent;
procedure AssignDefaultValue; override;
procedure TriggerSessionConnectedSpecial(Error : Word); override;
procedure TriggerSocksConnected(Error : Word); virtual;
procedure TriggerSessionClosed(Error : Word); override;
function TriggerDataAvailable(Error : Word) : Boolean; override;
procedure SetSocksPort(sPort : String); virtual;
procedure SetSocksServer(sServer : String); virtual;
procedure TriggerSocksError(Error : Integer; Msg : String); virtual;
procedure TriggerSocksAuthState(AuthState : TSocksAuthState);
function GetRcvdCount : LongInt; override;
procedure SetSocksLevel(newValue : String);
function DoRecv(var Buffer;
BufferSize : Integer;
Flags : Integer) : Integer; override;
procedure SocksDoConnect;
procedure SocksDoAuthenticate;
procedure DataAvailableError(ErrCode : Integer; Msg : String);
public
procedure Connect; override;
procedure Listen; override;
protected
property SocksServer : String read FSocksServer
write SetSocksServer;
property SocksLevel : String read FSocksLevel
write SetSocksLevel;
property SocksPort : String read FSocksPort
write SetSocksPort;
property SocksUsercode : String read FSocksUsercode
write FSocksUsercode;
property SocksPassword : String read FSocksPassword
write FSocksPassword;
property SocksAuthentication : TSocksAuthentication
read FSocksAuthentication
write FSocksAuthentication;
property OnSocksError : TSocksErrorEvent read FOnSocksError
write FOnSocksError;
property OnSocksConnected : TSessionConnected read FOnSocksConnected
write FOnSocksConnected;
property OnSocksAuthState : TSocksAuthStateEvent
read FOnSocksAuthState
write FOnSocksAuthState;
end;
{ You must define USE_SSL so that SSL code is included in the component. }
{ To be able to compile the component, you must have the SSL related files }
{ which are _NOT_ freeware. See http://www.overbyte.be for details. }
{$IFDEF USE_SSL}
{$I WSocketIntfSsl.inc}
{$ENDIF}
TLineLimitEvent = procedure (Sender : TObject;
RcvdLength : LongInt;
var ClearData : Boolean) of object;
{ You must define USE_SSL so that SSL code is included in the component. }
{ To be able to compile the component, you must have the SSL related files }
{ which are _NOT_ freeware. See http://www.overbyte.be for details. }
{$IFDEF USE_SSL}
TCustomLineWSocket = class (TCustomSslWSocket)
{$ELSE}
TCustomLineWSocket = class (TCustomSocksWSocket)
{$ENDIF}
protected
FRcvdPtr : PChar;
FRcvBufSize : LongInt;
FRcvdCnt : LongInt;
FLineEnd : String;
FLineMode : Boolean;
FLineLength : Integer; { When a line is available }
FLineLimit : LongInt; { Max line length we accept }
FLineReceivedFlag : Boolean;
FLineFound : Boolean;
FLineClearData : Boolean;
FLineEcho : Boolean; { Echo received data }
FLineEdit : Boolean; { Edit received data }
FTimeout : LongInt; { Given in milliseconds }
FTimeStop : LongInt; { Milliseconds }
FOnLineLimitExceeded : TLineLimitEvent;
procedure WndProc(var MsgRec: TMessage); override;
procedure WMTriggerDataAvailable(var Msg: TMessage); message WM_TRIGGER_DATA_AVAILABLE;
function TriggerDataAvailable(Error : Word) : Boolean; override;
procedure TriggerSessionClosed(Error : Word); override;
procedure TriggerLineLimitExceeded(Cnt: Integer;
var ClearData : Boolean); virtual;
procedure SetLineMode(newValue : Boolean); virtual;
procedure EditLine(var Len : Integer); virtual;
function GetRcvdCount : LongInt; override;
function DoRecv(var Buffer;
BufferSize : Integer;
Flags : Integer) : Integer; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function SendLine(const Str : String) : Integer; virtual;
property LineLength : Integer read FLineLength;
property RcvdPtr : PChar read FRcvdPtr;
property RcvdCnt : LongInt read FRcvdCnt;
published
property LineMode : Boolean read FLineMode
write SetLineMode;
property LineLimit : LongInt read FLineLimit
write FLineLimit;
property LineEnd : String read FLineEnd
write FLineEnd;
property LineEcho : Boolean read FLineEcho
write FLineEcho;
property LineEdit : Boolean read FLineEdit
write FLineEdit;
property OnLineLimitExceeded : TLineLimitEvent
read FOnLineLimitExceeded
write FOnLineLimitExceeded;
end;
{ DEPRECATED: DO NOT USE Synchronize, WaitUntilReady, ReadLine procedure }
{ for a new application. }
TCustomSyncWSocket = class(TCustomLineWSocket)
protected
FLinePoin
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -