How to receive HTTP messages using Socket

Posted by Poma on Stack Overflow See other posts from Stack Overflow or by Poma
Published on 2010-05-31T19:55:06Z Indexed on 2010/05/31 20:13 UTC
Read the original article Hit count: 222

Filed under:
|
|
|

I'm using Socket class for my web client. I can't use HttpWebRequest since it doesn't support socks proxies. So I have to parse headers and handle chunked encoding by myself. The most difficult thing is to determine length of content so I have to read it byte-by-byte. First I have to use ReadByte() to find last header ("\r\n\r\n" combination), then read chunk's size etc. But this approach has very poor performance. Can you suggest better solution? Maybe some open source examples or libraries that handle http request through sockets (not very big and complicated though, I'm a noob)

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET