mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 08:15:53 +01:00
0d8e5f842a
Handled AutoRefCount properties on ARC platform
63 lines
1.5 KiB
ObjectPascal
63 lines
1.5 KiB
ObjectPascal
program SSESample;
|
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
uses
|
|
System.SysUtils,
|
|
MVCFramework.Logger,
|
|
MVCFramework.Commons,
|
|
|
|
{$IFNDEF LINUX}
|
|
|
|
ReqMulti,
|
|
|
|
{$ENDIF}
|
|
|
|
Web.WebReq,
|
|
Web.WebBroker,
|
|
IdHTTPWebBrokerBridge,
|
|
SSEControllerU in 'SSEControllerU.pas',
|
|
WebModuleU in 'WebModuleU.pas' {MyWebModule: TWebModule} ,
|
|
StorageU in 'StorageU.pas';
|
|
|
|
{$R *.res}
|
|
|
|
procedure RunServer(APort: Integer);
|
|
var
|
|
LServer: TIdHTTPWebBrokerBridge;
|
|
begin
|
|
Writeln('** DMVCFramework Server ** build ' + DMVCFRAMEWORK_VERSION);
|
|
Writeln(Format('Starting HTTP Server on port %d', [APort]));
|
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
|
try
|
|
LServer.DefaultPort := APort;
|
|
LServer.Active := True;
|
|
LogI(Format('Server started on port 8080', [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;
|
|
Writeln('Press RETURN to stop the server');
|
|
ReadLn;
|
|
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.
|