S
samen
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.TCPServerExecute(AThread: TIdPeerThread);
var
SRequest: string;
SOutline: string;
AStream: TFileStream;
const
EOL: string = #13#10;
begin
with AThread.Connection do
begin
AThread.Synchronize(IncrConnectionCount);
//这里是线程同步函数吗?
WriteLn('Hello from Indy TCP Stream Server.');
try
SRequest := UpperCase(ReadLn);
if SRequest = 'OUTLINE' then
begin
AStream :=Tfilestream.Create('c:/a.txt',fmOpenREAD);
OpenWriteBuffer;
WriteStream(AStream);
CloseWriteBuffer;
AStream.Free;
end;
finally
Disconnect;
AThread.Synchronize(DecrConnectionCount);
end;
end;
end;
procedure TForm1.IncrConnectionCount;//这个过程起到什么作用??
begin
Inc(FConnectionCount);
Inc(FRequestCount);
Edit1.Text := IntToStr(FConnectionCount);
Edit2.Text := IntToStr(FRequestCount);
Edit1.Invalidate;
Edit2.Invalidate;
end;
procedure TForm1.DecrConnectionCount;//这个过程起到什么作用?
begin
Dec(FConnectionCount);
Edit1.Text := IntToStr(FConnectionCount);
Edit1.Invalidate;
end;
var
SRequest: string;
SOutline: string;
AStream: TFileStream;
const
EOL: string = #13#10;
begin
with AThread.Connection do
begin
AThread.Synchronize(IncrConnectionCount);
//这里是线程同步函数吗?
WriteLn('Hello from Indy TCP Stream Server.');
try
SRequest := UpperCase(ReadLn);
if SRequest = 'OUTLINE' then
begin
AStream :=Tfilestream.Create('c:/a.txt',fmOpenREAD);
OpenWriteBuffer;
WriteStream(AStream);
CloseWriteBuffer;
AStream.Free;
end;
finally
Disconnect;
AThread.Synchronize(DecrConnectionCount);
end;
end;
end;
procedure TForm1.IncrConnectionCount;//这个过程起到什么作用??
begin
Inc(FConnectionCount);
Inc(FRequestCount);
Edit1.Text := IntToStr(FConnectionCount);
Edit2.Text := IntToStr(FRequestCount);
Edit1.Invalidate;
Edit2.Invalidate;
end;
procedure TForm1.DecrConnectionCount;//这个过程起到什么作用?
begin
Dec(FConnectionCount);
Edit1.Text := IntToStr(FConnectionCount);
Edit1.Invalidate;
end;