TsgcWebSocketServer_HTTPAPI › 属性 › MaxConnections
http.sys 监听器接受的最大并发客户端连接数(零表示无限制)。
property MaxConnections: Integer read FMaxConnections write FMaxConnections;
0(无限制)
当该值大于零时,一旦达到限制,服务器将拒绝新的传入连接;现有会话不受影响。值为 0 时禁用上限(默认值)。可使用此属性在突发负载下保护主机免受资源耗尽,或在负载均衡集群中限制容量。该值在内核接受套接字后于用户态层面执行;若需更早拒绝流量,请结合使用 Firewall 或 RateLimiter。
oServer := TsgcWebSocketServer_HTTPAPI.Create(nil);
oServer.Host := '127.0.0.1';
oServer.Port := 80;
oServer.MaxConnections := 1000;
oServer.Active := true;