"Windows Socket+http Server Client"

Source: Internet
Author: User

Windows sockets+http Server Client
      Winsock is the standard for socket under Windows .          1.HTTP Protocol :
HTTP is a client/server-based request-Response protocol.
Request: Initiated by the client to the server, specifying the resources to be fetched from the server. The request contains the protocol header, indicating the client processing power information, such as the types of files that can be processed, supported languages, encoding methods, and so on. response: After the server receives the client's request, it resolves the request, constructs the response, and sends it to the client. The response also contains the protocol header, which indicates information about the server.           2. simple HTTP server and client :
The actual HTTP protocol, considering a variety of requirements, the Protocol has some complexity, here we only implement a simple HTTP server and client, the understanding of how the HTTP protocol works. under Winsock programming, the client sends a piece of data (that is, a request) to the client through the socket, which contains the resources (i.e., files) requested by the client. after the client receives the data, the data is processed (that is, the URL is parsed), the resource name requested by the client is extracted, the server resource is found according to the resource name, and the resource is sent to the client after the other information processing (that is, the response).           3.HTTP Server and client essence :
The HTTP protocol is built on the socket, which is essentially two programs that send data to each other through a socket. the HTTP protocol, which specifies the format in which the sender sends the data and how the receiving party uses the accepted data . Implementation of HTTP server and client, the implementation of the HTTP protocol is reflected in the two pairs of sending and receiving data processing. In the simplest case, the client sends a "get 1.html" data to the server, and after the server receives the data, it interprets "get 1.html", Understand that the client wants (GET) to the 1.html file, the server sends the contents of the 1.html file to the client, the client receives the data containing the 1.html file content, creates the new 1.html file and writes the data sent by the server side.
4. kind : run the server in VC6.0 first, and then open a VC6.0 to run the client.

operating effect : The Common browser is also the client, obviously our client is simply to print HTML file content, the browser will be HTML rules processing HTML files and then display.
Server and Client Reference "Winsock network programming Meridian" client program: Server program:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.