Getting Started with TCP/IP (4)--Application layer

Source: Internet
Author: User
Tags domain name server domain server file transfer protocol name database

/**

This blog by the history of ZJF collation and release, reproduced please indicate the source:

http://blog.csdn.net/zjf280441589/article/category/1854365

*/

The application layer in TCP/IP

Introduction to DNS

Domain Name System is the implementation of distributed computer system based on descriptive name-address mapping , and its function is to provide the mapping relationship between host name and IP address .

The resolution of the name-to-IP address is made up of several domain name servers, which run on a dedicated node, and the machine that runs the programs becomes the domain server.

1) Hierarchical Domain name space

The internet uses a hierarchical tree-like naming method, any host or router connected to the Internet has a unique hierarchical name, that is, the domain name;

The structure of the domain name consists of a sequence of labels separated by dots:

... . Level three domain name. Level two domain name. Top-level domain

Each label represents a different level of domain name;

A domain name is just a logical concept and does not represent the physical location of the computer, the variable length of the domain name, and the use of strings that help memory for people to use. The IP address is a fixed-length 32-bit binary number is very convenient for computer processing;

2) Domain Name server

Responsible for resolving the domain name to IP address. Both TCP and UDP port numbers are 53, and UDP is used primarily, and TCP is used for backup between servers.

Four types of domain name servers

1) ROOT name server: The highest level domain name server. Records the domain name and IP address of all top-level domain Servers . Regardless of which local domain name server, in order to resolve any domain name on the Internet, as long as they cannot resolve, first recourse to the root name server. There are 13 groups of root name servers on the Internet;

2) Top-level nameservers: Responsible for managing all two-level domain names registered with the top-level domain server. When a DNS query request is received, a corresponding answer is given (either the final result or the IP address of the domain name server that should be looked for next).

3) Rights domain Name server: is the domain Name server responsible for a zone. When a domain name server is unable to give the final query answer, it will tell the DNS client who issued the query request, the next step should be to find the right domain name server .

4) Local domain name server: When a host makes a DNS query request, this query request message is sent to the local domain name server. Every Internet service provider ISP, or a university, or even a university department, can have a local domain name server, which is sometimes referred to as the Default domain name server.

3) The parsing process of the domain name

(1) The client application invokes a library function called a parser, which passes the domain name of the destination host as a parameter to the parser;

(2) The parser sends a DNS request packet encapsulated in UDP datagram to the local domain name server port 53rd via the network, asking for the IP address corresponding to the domain name;

(3) The local domain name server to find its own domain name database (map file), the IP address of the domain name into a UDP datagram encapsulated DNS Response message, returned to the parser, if not found in the local domain name database, this domain name server temporarily become a global DNS customer , and makes a query request to the other nameservers until it finds a domain name server that can answer the request , and responds to the local domain name server with the result of the resolution The local domain name server then returns the parsed result to the client resolver;

(4) After the client resolver finally receives the response message, it returns the resolved IP address to the application.

Three ways to inquire:

1) Iterative Query

2) recursive query (less)

3) combination of recursion and iteration (common)

4) Domain name cache

Each domain name server maintains a cache that stores the most recently used names and where to get the name Mapping information . Can greatly reduce the load on the root domain server, so that the number of DNS query requests and response messages on the Internet is greatly reduced.

To keep the content in the cache correct, the domain name server should set a timer for each content and handle items that exceed a reasonable time. When a domain name server answers a query request, it indicates the time value in the response message that the binding is valid.


FTP

The FTP (file Transfer Protocol, Files Transfer Protocol) uses client/server mode. An FTP server process can serve multiple client processes at the same time. The FTP server process consists of two main parts: a master process that accepts new requests, and several subordinate processes, each of which is responsible for FTP services for one client .

FTP uses two TCP connections to complete file transfers, one for controlling connections and the other for data Connections . Normally the control link always waits for the client's connection request on port 21, when the user needs to transfer the file, the customer first actively establishes a control connection with the server port 21, which is used to transmit the customer's command and the server's answer . The client also informs the server of the data port that it will use, and the control link remains until the client and server FTP complete communication .

When the customer issues a file download , file upload , column directory data transfer request , server Port 20 actively and the client informs the data port to establish a data connection , and transfer data on it, The data transfer connection is closed immediately after the data transfer is complete .

Using two connections makes the protocol simpler and easier to implement on the one hand, while transferring files can also be used to interact with the server at the same time by using a control connection (such as when a client sends a request to terminate a file transfer).

For detailed configuration information about the FTP server, please refer to my blog

http://blog.csdn.net/zjf280441589/article/details/18868343

Tftp

The TFTP (Trivial file Transfer Protocol, simple Document Transfer Protocol) is also used to transfer files between the remote server and the local host, with no complex interactive access interface and authentication control over the FTP,TFTP. For environments where there is no need for complex interaction between the client and the server. The TFTP protocol is run based on the UDP protocol, using UDP port 69 for data transfer.

The difference between FTP and TFTP

Different transport protocols

FTP is TCP-based and TFTP is UDP-based

Different port numbers

FTP is using 21,20, TFTP is 69

Speed and safety

FTP is slow but safe, TFTP is fast but security is not as high as FTP.

www/World Wide Web

WWW works in client/server mode. Use port 80. The browser is the WWW client on the user's computer. The computer on which the WWW document resides is running a server program, also known as the WWW server. The client program makes a request to the server program and the server program sends the client program back to the WWW document requested by the client.

The protocol used to interact between the World Wide Web client and the World Wide Web server program is Hypertext Transfer Protocol HTTP (Hyper Text Transfer Protocol), and HTTP is reliably transmitted using TCP connections . HTTP is a transaction-oriented Application layer protocol, which is an important basis for reliable exchange of files (including text, sound, images, etc.) on the World Wide Web.

WWW uses the Uniform Resource Locator URL (Uniform Resource Locator) to flag various documents on the World Wide Web so that each document has a unique identifier URL across the entire Internet. General format of URLs

< protocol >://< host >:< port number >/< path >

Hypertext Markup Language HTML (Hyper Text Markup Language) makes it easy for the designer of the World Wide Web page to link to any Web page on the Internet from somewhere on this page with a hyperlink, and to display the pages on their own computer screen.

The working process of the World Wide Web:

< set the URL for the event that occurs after the http://www.tmtpost.com/99682.html> user clicks the mouse:

(1) Browser analysis hyperlink to the URL of the page.

(2) The browser resolves the IP address of the www.tmtpost.com to the DNS request.

(3) Domain Name System DNS resolves the IP address of the Titanium Media server.

(4) The browser establishes a TCP connection with the server

(5) The browser issued a fetch file command: get/99682.html

(6) The server gives a response and sends the file 99682.html to the browser.

(7) The TCP connection is released.

(8) The browser displays all the text in the Titanium Media related Web file 99682.html.

HTTP Key Features

HTTP is a transactional-oriented Client server protocol.

The HTTP protocol is stateless (stateless), i.e. the current state of the memory interaction is not required because the process is simple.

The HTTP 1.0 protocol is a non-persistent connection . After a TCP connection is established, an HTTP request in the past, an HTTP response comes in, and then the TCP connection is disconnected.

HTTP uses a connection-oriented TCP up-service . However, the HTTP protocol itself is not connected .

Continuous connection

Use a persistent connection different from the http/1.0,http/1.1 protocol.

The World Wide Web server still maintains this connection for a period of time after sending a response so that the same client (browser) and the server can continue to transmit subsequent HTTP request messages and response messages on this connection. And this is not limited to sending documents linked on the same page, but as long as the documents are on the same server.

The default setting for some popular browsers, such as IE 6.0, is to use http/1.1.

Two ways to work with continuous connections

Non-pipelined: The customer receives the previous response before making the next request . While this cost of twice times the RTT of a non-persistent connection saves a RTT time required to establish a TCP connection, the server's TCP connection is idle and the server's resources are wasted after sending an object.

Pipelining: A customer can then send a new request message before receiving an HTTP response message . One after the request message arrives at the server, the server can send back the response message continuously. When using pipelining, the customer accesses all objects with only one RTT time, reducing idle time in the TCP connection and improving the efficiency of the download document

HTTP Request message Format

The so-called "method" is the action on the requested object, so these methods are actually some commands. Moreover, the type of request message is determined by the method it uses.

HTTP Response message Format

The start line of the response message is the status line, which includes three items, the version of HTTP, the status code, and a simple phrase explaining the status code.


Note: This series of blog package: http://download.csdn.net/download/hanqing280441589/8574157

Getting Started with TCP/IP (4)--Application layer

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.