Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];

Вниз

SOCKS5 server   Найти похожие ветки 

 
Ghost.   (2002-02-17 13:03) [11]

(******************************************************************************
DESTROY:
Destory this object.
******************************************************************************)
destructor TDXSOCKSV4ServerCore.Destroy;
Var
PSimpleEvent:PSOCKSV4SimpleEvent;

begin
While fEventArray.Count>0 do Begin
Case PSOCKSV4SimpleEvent(fEventArray[0]).Tag of
1:Begin
PSimpleEvent:=fEventArray[0];
Dispose(PSimpleEvent);
End;
End;
fEventArray.Delete(0);
End;
inherited Destroy;
end;

(******************************************************************************
ADDSimpleEVENT:
Allows you to dynamically assign a new command to the internal
parser. This allows the servercore to support the "pre-defined"
OnCommand* events, plus you can add other commands dynamically
at run-time in your application without requiring a source code
modification to our components!

To make support easier for us, we ask that you use the Add*Event
procedures to expand our code, reducing code changes when an
upgrade is released!

See documentation for complete information on how this works.

Example Usage: AddSimpleEvent("CDROM",MySpecialEvent);
******************************************************************************)
Procedure TDXSOCKSV4ServerCore.AddBasicEvent(Command:String;EventProc:SOCKSV4TSimpleEvent);
Var
PSimpleEvent:PSOCKSV4SimpleEvent;
Loop:Integer;

Begin
Command:=Uppercase(Command);
Loop:=0;
While Loop<fEventArray.Count do Begin
If PSOCKSV4SimpleEvent(fEventArray[Loop]).Command=Command then Begin
PSOCKSV4SimpleEvent(fEventArray[Loop]).EventProcedure:=EventProc;
Exit;
End
Else Inc(Loop);
End;
New(PSimpleEvent);
PSimpleEvent.Tag:=1; // Denotes Event in fEventArray is a TSimpleEvent!
PSimpleEvent.Command:=Command;
PSimpleEvent.EventProcedure:=EventProc;
fEventArray.Add(PSimpleEvent);
End;

Procedure TDXSOCKSV4ServerCore.SetOnCommandUSER(value:SOCKSV4TSimpleEvent);
Begin
fOnCommandUSER:=Value;
AddBasicEvent("USER",Value);
End;

(******************************************************************************
PROCESSSESSION:
If you want this CORE to process the parsing, you should call
this from your "OnNewConnect" implementation. This should be
right after your call to SayHello (optional).
******************************************************************************)
procedure TDXSOCKSV4ServerCore.ProcessSession(ClientThread: TDXServerThread);
var
s, sCmd: string;
Loop:Integer;
WasHandled:Boolean;

procedure NotHandled(CMD: string);
Var
Ws:String;

begin
Ws:="500 command not recognized (" + CMD + ")";
ClientThread.Socket.Writeln(Ws);
end;

begin
with ClientThread.Socket do begin
s:=ReadLn(fiTimeout);
If LastReadTimeout or Not ValidSocket then Exit;
sCmd:=UpperCase(Fetch(s,#32,False));
Loop:=0;
WasHandled:=False;
While (Loop<fEventArray.Count) and (Not WasHandled) do Begin
If PSOCKSV4SimpleEvent(fEventArray[Loop]).Command=sCMD then Begin
Case PSOCKSV4SimpleEvent(fEventArray[Loop]).Tag of
1:if Assigned(PSOCKSV4SimpleEvent(fEventArray[Loop]).EventProcedure) then
SOCKSV4TSimpleEvent(PSOCKSV4SimpleEvent(fEventArray[Loop]).EventProcedure)(ClientThread);
End;
WasHandled:=True;
End
Else Inc(Loop);
End; {while}
If Not WasHandled then Begin
if assigned(OnCommandOther) then
OnCommandOther(ClientThread,sCmd,s,WasHandled);
end;
if not WasHandled then NotHandled(sCmd);
end; {with}
end; {doExecute}

end.



Страницы: 1 вся ветка

Форум: "Сети";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.005 c
7-94591
Raider
2002-01-08 16:32
2002.04.29
Debuger vs Win XP pro


7-94604
SV
2002-01-31 13:18
2002.04.29
Shell


1-94351
Каспер
2002-04-17 07:03
2002.04.29
Коротко и быстро


3-94293
binsprog
2002-04-08 20:14
2002.04.29
Getting username using TDatabase


3-94306
Seri
2002-04-05 07:02
2002.04.29
Не полная(целая) строка в DBGrid





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский