E
eMetal
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TMyServerThread.ClientExecute;
var
Stream : TWinSocketStream;
Buffer : array[0 .. 9] of Char;
begin
while (not Terminated) and ClientSocket.Connected do
begin
try
Stream := TWinSocketStream.Create(ClientSocket, 60000);
try
FillChar(Buffer, 10, 0); { initialize the buffer }
if Stream.WaitForData(60000) then //当等待时,会停留在这里
begin
if Stream.Read(Buffer, 10) = 0 then //[red]问题:为什么当客户机死机时代码能继续执行到这里[/red]
ClientSocket.Close;
{ now process the request }
...
end
else
ClientSocket.Close; { if client doesn抰 start, close }
finally
Stream.Free;
end;
except
HandleException;
end;
end;
end;
var
Stream : TWinSocketStream;
Buffer : array[0 .. 9] of Char;
begin
while (not Terminated) and ClientSocket.Connected do
begin
try
Stream := TWinSocketStream.Create(ClientSocket, 60000);
try
FillChar(Buffer, 10, 0); { initialize the buffer }
if Stream.WaitForData(60000) then //当等待时,会停留在这里
begin
if Stream.Read(Buffer, 10) = 0 then //[red]问题:为什么当客户机死机时代码能继续执行到这里[/red]
ClientSocket.Close;
{ now process the request }
...
end
else
ClientSocket.Close; { if client doesn抰 start, close }
finally
Stream.Free;
end;
except
HandleException;
end;
end;
end;