procedure
TServerThread
.
ClientExecute;
var
fRequest :
AnsiString
;
p :
Integer
;
begin
try
fSocketStream:=TWinSocketStream
.
Create(ClientSocket,TIMEOUT);
try
while
(
not
Terminated)
and
(ClientSocket
.
Connected)
do
try
if
(
not
Terminated)
and
(
not
fSocketStream
.
WaitForData(TIMEOUT))
then
begin
ClientOff(msg_Connection_Timeout);
break;
end
;
if
(
not
Terminated)
then
begin
fRequest:=
''
;
if
fSocketStream<>
nil
then
begin
SetLength(fRequest,ClientSocket
.
ReceiveLength());
SetLength(fRequest,ClientSocket
.
ReceiveBuf(
Pointer
(fRequest)^,Length(fRequest)));
end
else
begin
ClientOff(msg_Connection_Closed);
break;
end
;
p:=Pos(Chr(
$0D
),fRequest);
if
(p>
0
)
and
(
not
Terminated)
then
begin
end
else
begin
ClientOff(msg_Connection_Closed);
end
;
end
;
Application
.
ProcessMessages;
except
on
e:exception
do
begin
ClientOff(msg_Connection_Closed);
end
;
end
;
finally
ClientOffmsg_Connection_Closed);
end
;
except
on
e:exception
do
begin
ClientOff(msg_Connection_Closed);
end
;
end
;
inherited
;
end
;