delphimvcframework/samples/middleware_analytics/middleware_analytics.dpr

64 lines
1.6 KiB
ObjectPascal
Raw Normal View History

2019-01-08 12:48:27 +01:00
program middleware_analytics;
{$APPTYPE CONSOLE}
uses
System.SysUtils,
MVCFramework,
2019-01-08 12:48:27 +01:00
MVCFramework.Logger,
MVCFramework.Commons,
MVCFramework.Signal,
2019-01-08 12:48:27 +01:00
MVCFramework.REPLCommandsHandlerU,
Web.ReqMulti,
Web.WebReq,
Web.WebBroker,
IdHTTPWebBrokerBridge,
MainControllerU in 'MainControllerU.pas',
WebModuleU in 'WebModuleU.pas' {MyWebModule: TWebModule},
MVCFramework.Middleware.Analytics in '..\..\sources\MVCFramework.Middleware.Analytics.pas';
{$R *.res}
procedure RunServer(APort: Integer);
var
lServer: TIdHTTPWebBrokerBridge;
begin
Writeln('** DMVCFramework Server ** build ' + DMVCFRAMEWORK_VERSION);
LServer := TIdHTTPWebBrokerBridge.Create(nil);
try
LServer.DefaultPort := APort;
{ more info about MaxConnections
http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_MaxConnections.html }
LServer.MaxConnections := 0;
{ more info about ListenQueue
http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_ListenQueue.html }
LServer.ListenQueue := 200;
lServer.Active := True;
Writeln('Listening on port: ', APort);
WriteLn('CTRL+C to shutdown the server');
WaitForTerminationSignal;
EnterInShutdownState;
lServer.Active := False;
2019-01-08 12:48:27 +01:00
finally
LServer.Free;
end;
end;
begin
ReportMemoryLeaksOnShutdown := True;
IsMultiThread := True;
try
if WebRequestHandler <> nil then
WebRequestHandler.WebModuleClass := WebModuleClass;
WebRequestHandlerProc.MaxConnections := 1024;
RunServer(8080);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.