THttpAsyncServer使用
THttpAsyncServer使用
unit Unit1; interface uses mormot.net.async, mormot.net.http, mormot.net.server, Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } server: THttpAsyncServer; function process(Ctxt: THttpServerRequestAbstract): cardinal; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin var port: UTF8String := '1234'; var threadPoolCount: Integer := 32; var KeepAliveTimeOut: Integer := 30000; server := THttpAsyncServer.Create(port, nil, nil, 'yn', threadPoolCount, KeepAliveTimeOut, [hsoNoXPoweredHeader]); var queueLen: Integer := 1000; server.HttpQueueLength := queueLen; server.OnRequest := process; server.WaitStarted(); end; procedure TForm1.FormDestroy(Sender: TObject); begin FreeAndNil(server); end; function TForm1.process(Ctxt: THttpServerRequestAbstract): cardinal; begin end; end.
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/17057789.html