?? overbyte.ics.wsocket.pas
字號:
procedure AssignDefaultValue; override;
procedure TriggerSessionConnectedSpecial(ErrCode : Word); override;
procedure TriggerSocksConnected(ErrCode : Word); virtual;
procedure TriggerSessionClosed(ErrCode : Word); override;
function TriggerDataAvailable(ErrCode : Word) : Boolean; override;
procedure SetSocksPort(sPort : String); virtual;
procedure SetSocksServer(sServer : String); virtual;
procedure TriggerSocksError(ErrCode : Integer; Msg : String); virtual;
procedure TriggerSocksAuthState(AuthState : TSocksAuthState);
function GetRcvdCount : LongInt; override;
procedure SetSocksLevel(newValue : String);
function DoRecv(out Buffer : TBytes;
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;
TLineLimitEvent = procedure (Sender : TObject;
RcvdLength : LongInt;
var ClearData : Boolean) of object;
TCustomLineWSocket = class (TCustomSocksWSocket)
protected
FRcvdPtr : TBytes;
FRcvBufSize : LongInt;
FRcvdCnt : LongInt;
FLocalBuf : TBytes;
FLineEnd : String;
FLineMode : Boolean;
FLineLength : Integer; { When a line is available }
FLineLimit : LongInt; { Max line length we accept }
FLineReceivedFlag : 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(ErrCode : Word) : Boolean; override;
procedure TriggerSessionClosed(ErrCode : 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(out Buffer : TBytes;
BufferSize : Integer;
Flags : Integer) : Integer; override;
public
constructor Create(AOwner: {$IFDEF ICS_COMPONENT}TComponent
{$ELSE}TObject{$ENDIF}); override;
destructor Destroy; override;
property LineLength : Integer read FLineLength;
property RcvdPtr : TBytes 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;
TCustomSyncWSocket = class(TCustomLineWSocket)
protected
FLineBuffer : TBytes;
function Synchronize(Proc : TWSocketSyncNextProc; var DoneFlag : Boolean) : Integer; virtual;
function WaitUntilReady(var DoneFlag : Boolean) : Integer; virtual;
procedure InternalDataAvailable(Sender: TObject; ErrCode: Word);
public
procedure ReadLine(Timeout : integer; var Buffer : String);
end;
TWSocket = class(TCustomSyncWSocket)
public
property PortNum;
property Handle;
property HSocket;
property BufSize;
property Text;
property AllSent;
property OnDisplay;
published
property Addr;
property Port;
property Proto;
property LocalAddr;
property LocalPort;
property PeerPort;
property PeerAddr;
property DnsResult;
property DnsResultList;
property State;
property ReadCount;
property RcvdCount;
property LastError;
property MultiThreaded;
property MultiCast;
property MultiCastAddrStr;
property MultiCastIpTTL;
property ReuseAddr;
property ComponentOptions;
property ListenBacklog;
property OnDataAvailable;
property OnDataSent;
property OnSendData;
property OnSessionClosed;
property OnSessionAvailable;
property OnSessionConnected;
property OnSocksConnected;
property OnChangeState;
{ property OnLineTooLong; }
property OnDnsLookupDone;
property OnError;
property OnBgException;
property FlushTimeout;
property SendFlags;
property LingerOnOff;
property LingerTimeout;
property SocksLevel;
property SocksServer;
property SocksPort;
property SocksUsercode;
property SocksPassword;
property SocksAuthentication;
property OnSocksError;
property OnSocksAuthState;
end;
function WinsockInfo : TWSADATA;
function WSocketErrorDesc(ErrCode: Integer) : String;
function WSocketGetHostByAddr(const Addr : String) : IntPtr;
function WSocketGetHostByName(const Name : String) : IntPtr;
function LocalHostName : String;
function LocalIPList : TStrings;
function WSocketResolveIp(const IpAddr : String) : String;
function WSocketResolveHost(const InAddr : String) : TInAddr;
function WSocketResolvePort(const Port : String; const Proto : String) : Word;
function WSocketResolveProto(const Proto : String) : Integer;
function WSocketIsDottedIP(const S : String) : Boolean;
function WSocket_WSAStartup(wVersionRequired : word;
out WSData : TWSAData): Integer;
function WSocket_WSACleanup : Integer;
procedure WSocket_WSASetLastError(ErrCode: Integer);
function WSocket_WSAGetLastError: Integer;
function WSocket_WSACancelAsyncRequest(hAsyncTaskHandle: THandle): Integer;
function WSocket_WSAAsyncGetHostByName(HWindow: HWND; wMsg: u_int;
const name : String; buf: IntPtr;
buflen: Integer): THandle;
function WSocket_WSAAsyncGetHostByAddr(HWindow: HWND;
wMsg: u_int; var addr: u_long;
len, Struct: Integer;
buf: IntPtr;
buflen: Integer): THandle;
function WSocket_WSAAsyncSelect(s : TSocket;
HWindow : HWND;
wMsg : u_int;
lEvent : Longint): Integer;
function WSocket_recv(s: TSocket;
out Buf : TBytes; len, flags: Integer): Integer;
function WSocket_recvfrom(s : TSocket;
out Buf : TBytes; len, flags: Integer;
var from : TSockAddr;
var fromlen : Integer): Integer;
function WSocket_getservbyname(const name, proto: String): IntPtr;
function WSocket_getprotobyname(const name: String): IntPtr;
function WSocket_gethostbyname(const name: String): IntPtr;
function WSocket_gethostbyaddr(var addr: u_long; len, Struct: Integer): IntPtr;
function WSocket_gethostname(out name: String): Integer;
function WSocket_socket(af, Struct, protocol: Integer): TSocket;
function WSocket_shutdown(s: TSocket; how: Integer): Integer;
function WSocket_setsockopt(s: TSocket; level, optname: Integer;
var optval: Integer;
optlen: Integer): Integer; overload;
function WSocket_setsockopt(s: TSocket; level, optname: Integer;
var optval: ip_mreq;
optlen: Integer): Integer; overload;
function WSocket_setsockopt(s: TSocket; level, optname: Integer;
var optval: TInAddr;
optlen: Integer): Integer; overload;
function WSocket_setsockopt(s: TSocket; level, optname: Integer;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -