http(Hypertext Transfer Protocol) is a stateless, application-level protocol based on the request-and-response pattern ,when surfing the web, the browser andWebbetween servers throughHTTPin theInternetto send and receive data on the Often based onTCPthe connection methodhttpindicates that you want to passHTTPprotocol to locate network resources;Hostrepresents a legitimateInternethost domain name orIPaddress;PortSpecify a port number that is empty when you use the submit request,HTTPThe protocol is routed toWebserver. Webafter the server is received, the transaction is processed, and the result is passedHDefault Port the;Abs_pathspecifying the request resource'sURI; ifURLnot given in theAbs_path, then when it is requestedURI, you must use the"/"in the form given, usually this work browser automatically helps us finish.
(1) connection:Web Browser establishes a connection to the Web server and opens a virtual file called a Socket(socket). The establishment of this file marks a successful connection establishment.
(2)Request:WebBrowser throughSockettoWebThe server submits the request. HTTPthe request is generallyGETorPOSTCommand (POSTused toFORMparameter is passed). GETthe format of the command is:GETPath/file namehttp/1.0The file name indicates which files are accessed,http/1.0pointed outWebbrowser-UsedHTTPversion.
(3) answer:the Web browser will send the TTP back to the Web Browser, thus the web The requested page is displayed on the browser.
The difference between TCP and UDP and Application
(1)TCP is a connection-oriented Transmission Control protocol, while UDP provides a non-connected datagram service;
(2)TCP has high reliability, ensure the correctness of transmission data, no loss or disorderly sequence;UDP does not establish a connection before transmitting data, so packet loss occurs , duplication, and chaos, the application needs to be responsible for all the work on transmission reliability;
(3)UDP has better real-time performance and higher efficiency than TCP protocol.
(4)UDP segment Structure is simpler and less expensive than TCP segment structure.
TCP is typically used for file transfers (FTP HTTP requires high data accuracy and is relatively slow), Send and receiveMail (POP IMAP SMTP High data accuracy requirements, non-emergency applications), remote login (telnet SSH to the accuracy of the data has a certain requirements, there is a connection concept); UDP is generally used for instant communication (QQ Chat on data accuracy and packet loss requirements are relatively low, but the speed must be fast), online video (RTSP speed must be fast, to ensure continuous video), Network voice Phone (voice packet is generally small, need high-speed transmission)
Brief introduction to the difference and application of HTTP protocol and TCP,UDP