/// <summary> /// Initializes a new instance of the <see cref="HttpConnection"/> class. /// </summary> /// <param name="server">The server.</param> /// <param name="id">The identifier.</param> /// <param name="client">The client.</param> public HttpConnection(HttpServer server, Guid id, TcpClient client) { this.client = client; this.address = ((IPEndPoint)client.Client.RemoteEndPoint).Address.ToString(); this.server = server; this.id = id; this.protocol = HttpProtocol.HTTP; // process Utilities.InvokeAsync(Process); }
/// <summary> /// Initializes a new instance of the <see cref="WebApplication"/> class. /// </summary> /// <param name="port">The port.</param> /// <param name="name">The name.</param> public WebApplication(int port, string name) : base(name) { // server HttpServer server = new HttpServer(port); server.Request += HandleRequest; server.Error += HandleError; server.Serializer = new JSONSerializer(SerializerFormat.Minimized); // attach Attach(server); // search for routes Add(Assembly.GetEntryAssembly()); }