private void AcceptTcpClient(IAsyncResult ar) { var listener = (TcpListener) ar.AsyncState; var client = listener.EndAcceptTcpClient(ar); HttpProcessor processor = new HttpProcessor(client, this); Thread thread = new Thread(processor.process); thread.IsBackground = true; thread.Start(); tcpCLientConnected.Set(); }
public override void handleGETRequest(HttpProcessor p) { if (p.http_url == "/") { p.writeSuccess(); p.outputStream.WriteLine(File.ReadAllText("Website/index.html")); return; } if (!File.Exists("Website" + p.http_url)) { p.writeFailure(); return; } if(p.http_url.EndsWith(".css")) p.writeSuccess("text/css"); else p.writeSuccess(); p.outputStream.WriteLine(File.ReadAllText("Website" + p.http_url)); }
public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData) { throw new NotImplementedException(); }
public abstract void handlePOSTRequest(HttpProcessor p, StreamReader inputData);
public abstract void handleGETRequest(HttpProcessor p);