/// <summary> /// SAEA WebServer /// </summary> /// <param name="httpContentType">处理对象</param> /// <param name="root">根目录</param> /// <param name="port">监听端口</param> /// <param name="isStaticsCached">是否启用静态缓存</param> /// <param name="isZiped">是压启用内容压缩</param> /// <param name="bufferSize">http处理数据缓存大小</param> /// <param name="count">http连接数上限</param> /// <param name="timeOut">超时</param> /// <param name="isDebug">测试模式</param> public WebHost(Type httpContentType = null, string root = "wwwroot", int port = 39654, bool isStaticsCached = true, bool isZiped = true, int bufferSize = 1024 * 10, int count = 10000, int timeOut = 120 * 1000, bool isDebug = false) { if (httpContentType != null && _httpContentType.GetInterface("SAEA.Http.Model.IHttpContext", true) != null) { _httpContentType = httpContentType; } else { _httpContentType = typeof(HttpContext); } WebConfig = new WebConfig() { Root = root, Port = port, IsStaticsCached = isStaticsCached, IsZiped = isZiped, HandleBufferSize = bufferSize, ClientCounts = count }; HttpUtility = new HttpUtility(WebConfig.Root); if (isDebug) { _serverSocket = new HttpSocketDebug(port, bufferSize, count, timeOut); } else { _serverSocket = new HttpSocket(port, bufferSize, count, timeOut); } _serverSocket.OnRequested += _serverSocket_OnRequested; }
public CoordinatorContext(IHttpSocket httpSocket) : base(httpSocket) { }
/// <summary> /// Initialise a new instance, injecting dependencies /// </summary> /// <param name="socket"></param> public HttpClient(IHttpSocket socket) { this._socket = socket; }