title: How can i read client request?
body: <p>I have create an httplistener. So i need when client will send me data to read them. The problem is that i dont know how client should send the data</p>
  
  <pre><code>HttpListener listener = new HttpListener();
          listener.Prefixes.Add("http://192.168.1.26:8282/");
          listener.Prefixes.Add("http://localhost:8282/");
          listener.Prefixes.Add("http://127.0.0.1:8282/");
  
          listener.Start();
          new Thread(() =&gt;
          {
              Thread.CurrentThread.IsBackground = true;
              for (;;)
              {
  
  
                  Console.WriteLine("Listening...");
                  // Note: The GetContext method blocks while waiting for a request. 
                  HttpListenerContext context = listener.GetContext();
                  HttpListenerRequest request = context.Request;
                  string text;
                  using (var reader = new StreamReader(request.InputStream,
                                                       request.ContentEncoding))
                  {
                      text = reader.ReadToEnd();
                      MessageBox.Show(text);
                  }
  
  
  
                  // Obtain a response object.
                  HttpListenerResponse response = context.Response;
                  // Construct a response.
                  string responseString = "HelloWorld";
                  byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
                  // Get a response stream and write the response to it.
                  response.ContentLength64 = buffer.Length;
                  System.IO.Stream output = response.OutputStream;
                  output.Write(buffer, 0, buffer.Length);
                  // You must close the output stream.
                  output.Close();
  
              }
  
  
  
          }).Start();
  
      }
  </code></pre>
  
  <p>So from client i send this command:</p>
  
  <pre><code>GET / 192.168.1.26:8282 HTTP/1.0
  </code></pre>
  
  <p>But i'm getting this message</p>
  
  <pre><code>    Recv 34 bytes
  
  SEND OK
  
  +IPD,1,518:HTTP/1.1 400 Bad Request
  Content-Type: text/html; charset=us-ascii
  Server: Microsoft-HTTPAPI/2.0
  Date: Wed, 13 Jun 2018 13:16:03 GMT
  Connection: close
  Content-Length: 339
  
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Bad Request&lt;/TITLE&gt;
  &lt;META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"&gt;&lt;/HEAD&gt;
  &lt;BODY&gt;&lt;h2&gt;Bad Request - Invalid Header&lt;/h2&gt;
  &lt;hr&gt;&lt;p&gt;HTTP Error 400. The request has an invalid header name.&lt;/p&gt;
  &lt;/BODY&gt;&lt;/HTML&gt;
  1,CLOSED
  </code></pre>
  
  <p>I cant understand what is wrong. Also in my code i set to get a message box every time a request will happen. But it never runs</p>
  
  <p>This s what mozilla is sending
  <a href="https://i.stack.imgur.com/8lma9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8lma9.png" alt="enter image description here"></a></p>