6 KOL
, blcksock
, winsock
;
9 PTCPEchoDaemon
= ^TTCPEchoDaemon
;
10 TTCPEchoDaemon
= object(TThread
)
12 Sock
: PTCPBlockSocket
;
14 function Execute
: Integer;
17 PTCPEchoThrd
= ^TTCPEchoThrd
;
18 TTCPEchoThrd
= object(TThread
)
20 Sock
: PTCPBlockSocket
;
22 function Execute
: Integer;
25 function NewEchoDaemon
: PTCPEchoDaemon
;
27 function NewEchoThrd(hSock
: TSocket
) : PTCPEchoThrd
;
33 function NewEchoDaemon
: PTCPEchoDaemon
;
36 Result
.Sock
:= NewTCPBlockSocket('');
37 Result
.Add2AutoFree(Result
.Sock
);
38 Result
.AutoFree
:= true;
39 // Result.PriorityClass := NORMAL_PRIORITY_CLASS;
40 // Result.ThreadPriority := THREAD_PRIORITY_NORMAL;
41 if Result
.Suspended
then Result
.Resume
;
45 function TTCPEchoDaemon
.Execute
: Integer;
54 Bind('0.0.0.0','echo');
57 if Terminated
then Break
;
61 if LastError
= 0 then NewEchoThrd(ClientSock
);
69 function NewEchoThrd(hSock
: TSocket
) : PTCPEchoThrd
;
72 Result
.Sock
:= NewTCPBlockSocket('');
73 Result
.Add2AutoFree(Result
.Sock
);
74 Result
.AutoFree
:= true;
76 // Result.PriorityClass := NORMAL_PRIORITY_CLASS;
77 // Result.ThreadPriority := THREAD_PRIORITY_NORMAL;
78 if Result
.Suspended
then Result
.Resume
;
82 function TTCPEchoThrd
.Execute
: Integer;
90 if Terminated
then Break
;
92 if LastError
<>0 then Break
;
94 if LastError
<>0 then Break
;