This article I send other forum articles, at the same time published in their own blog.
Background:
write this just for yourself to understand some of the underlying technology, some things have to write their own to better understand. The reason to put on the forum is to let the novice understand the essence of things, do not be confused by some superficial things, or will go a lot of detours.
Introduction:
1: Support post + GET request in fact for what request library is not concerned.
2: Support 302 jump.
3: Simple parsing of the request header + return header.
4: Simple cookie support.
The Fidder of the packet simulator machine is not a supported cookie, this reason is due to the decision of his framework.
principle:
1: Packet sending and receiving are definitely sockets sent and received.
2: Constructs an HTTP packet. (The library provides simple property settings that make it an object-oriented), so it's better to do so.
3: Parse the returned packets, parse the HTTP, and instantiate the corresponding objects.
Example:
the only csdn http login.
1: Gets the serial number of the CSDN login.
2: constructs the corresponding packet.
3: Visit my csdn. (The data is not transcoded, the Chinese will be garbled.) )。
Small Fish
QQ Group: 274301756 (Programming Hobby Group).
Code: http://www.cctry.com/thread-249742-1-1.html
Can leave the mailbox I send you the link
Socket implementation HttpClient Simple class +CSDN login source