为什么会出现异步操作,怎么解决
while (not Terminated) and ClientSocket.Connected do
begin
try
Stream := TWinSocketStream.Create(ClientSocket, 60000);
try
FillChar(Buffer,4096,0);
if Stream.WaitForData(60000) then
begin
clientIp := clientsocket.RemoteAddress;
Stream.Read(Buffer,4096);
ClientSocket.Close;
senddata(StringReplace(string(Buffer), #13#10, '', rfReplaceAll]),clientIp);
end
else
ClientSocket.Close;
finally
Stream.Free;
end;
except
HandleException;
end;
end;
采用上面serversocket多线程然后插入到数据库中,由于对数据处理的时间过长,如果才客户端一次发送很多请求。如果程序正在处理当前数据那么会出现异步运行时,操作被终止,怎么办啊