Writing a "raw" HTTP client in C# -


I am trying to write a "raw" HTTP client in C #. Why can you ask?

My goal is to implement an HTTP client in J2ME (which can only POET GET and limited), but first I have to understand the HTTP protocol better (hence the C # effort).

My first attempt is failing:

  var requestBytes = encoding.UTF8.GetBytes (@ "GET / HTTP / 1.1 User-agent: CSHRAP host: www. Google.com "); Var Socket = New Socket (Address Family.Inter Network, SocketType.Stream, ProtocolType.Tcp); Socket Connect ("www.google.com", 80); Socket.Send (requestBytes); Var feedbackbits = new byte [socket. Resave Buffer Size]; Socket.Receive (responseBytes); Console.Out.Write (Encoding.UTF8.GetString (responseBytes));  

The socket opens, but then the received call blocks. After a few seconds the remote host closes the connection.

Any thoughts?

This is what happens when I try to connect using Raw mode in PiTi.

If you are testing this, then it may be best that IIS or Apache Locally install and then address 127.0.0.1; This gives you more opportunities to test various things!

Being a strange thing, I do not like it if someone uses my website to test the implementation of HTTP protocol.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -