Преглед изворни кода

Info about active connections

Ondrej Pokorny пре 4 година
родитељ
комит
7ccdcd3d14
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      packages/fcl-web/examples/httpserver/threadedhttpserver.pas

+ 4 - 1
packages/fcl-web/examples/httpserver/threadedhttpserver.pas

@@ -13,6 +13,8 @@ Type
   THTTPServer = class(TTestHTTPServer)
   protected
     function CreateConnection(Data: TSocketStream): TFPHTTPConnection; override;
+  public
+    Property ConnectionCount;
   end;
 
   TServerThread = class(TThread)
@@ -53,7 +55,7 @@ begin
   FServ.Threaded:=True;
   FServ.Port:=8080;
   FServ.WriteInfo := @WriteInfo;
-  FServ.AcceptIdleTimeout := 500;
+  FServ.AcceptIdleTimeout := 1000;
   FServ.OnAcceptIdle := @ServOnIdle;
 end;
 
@@ -71,6 +73,7 @@ end;
 
 procedure TServerThread.ServOnIdle(Sender: TObject);
 begin
+  WriteInfo('Active connections: '+IntToStr(FServ.ConnectionCount));
   if Terminated then
     FServ.Active := False;
 end;