Esempio n. 1
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     try
     {
         port           = int.Parse(ConfigurationManager.AppSettings["Port"]);
         httpServer     = new HttpServer(port);
         httpServer.frm = this;
         Thread thread = new Thread(new ThreadStart(httpServer.listen));
         thread.Start();
         httpServer.Display("Start listen to " + ComputerUtility.IpAddress + ":" + port.ToString(), "", "", "");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.Source + ex.StackTrace);
     }
 }
Esempio n. 2
0
        public void process()
        {
            try
            {
                http_method = context.Request.HttpMethod;
                http_url    = context.Request.Url.AbsoluteUri;
                if (context.Request.HttpMethod == "POST")
                {
                    handlePOSTRequest();
                }
                else if (context.Request.HttpMethod == "GET")
                {
                    handleGETRequest();
                }
            }
            catch (Exception e)
            {
                srv.Display("Exception: " + e.ToString(), "", "", "");
                writeFailure();
            }

            context.Response.OutputStream.Close();
            context.Response.Close();
        }