Introduction to the TCP/IP protocol of the basic application layer (HTTP/FTP/POP/SMTP)

Source: Internet
Author: User

 

Introduction to the TCP/IP protocol at the basic application layer (HTTP/FTP/POP/SMTP)

Source: http://www.networkdictionary.com/chinese/protocols/tcpip.php

 

HTTP: Hypertext Transfer Protocol

For more detailed HTTP header information, refer to my previous blog article.

HTTP: Hypertext Transfer Protocol
  HTTP: Hypertext Transfer Protocol

Hypertext Transfer Protocol (HTTP) is an application layer protocol. It is applicable to distributed and cooperative hypermedia information systems due to its simple and fast method. Since 1990, HTTP has been applied to the WWW global information service system.

HTTP allows the use of a free reply method to indicate the purpose of the request. It is based on the reference principle provided by the Uniform Resource Identifier (URI) and serves as an address (URL) or name (URN ), it indicates the method used to transmit messages in a format similar to the network mail and multi-purpose Internet Mail extended protocol (MIME.

HTTP can also be used as a common protocol to implement communication between a user proxy and a proxy server or gateway that connects to other Internet services (such as SMTP, nntp, FTP, Gopher, and WAIS, allows basic hypermedia to access resources provided by various applications and simplifies the implementation of the user agent system.

HTTP is a request/response protocol. After a client establishes a connection with the server, it sends a request to the server. The request format is Uniform Resource Identifier (URI) and Protocol version number, followed by mime-like information, includes request modifiers, client information, and possible content. After receiving the request, the server returns the corresponding response information in the format of a status line containing the Protocol version number of the information, a successful or wrong code, followed by mime-like information, includes server information, entity information, and possible content.

The first version of HTTP/0.9 is a simple protocol for transmitting raw data between networks. HTTP/1945 defined by RFC 1.0 has been further improved based on the original HTTP/0.9, allowing messages to exist in mime-like information formats, including transmitted data and modifiers in the request/response paradigm. However, HTTP/1.0 does not fully consider the performance of layered proxy servers, high-speed buffer storage, persistent connections, or virtual hosts. In contrast, HTTP/1.1 requires more stringent requirements to ensure service reliability. The security enhanced edition of HTTP (that is, S-HTTP) will be further described in the relevant files.

Protocol Structure

An HTTP packet consists of a request from the client to the server and a response from the server to the client. The Request Message format is as follows:

Request Line Common Information Header Request Header Entity Header Message Body

The request line starts with the method field, followed by the URL field and HTTP Protocol version field, and ends with CRLF. SP is a separator. In the final CRLF sequence, CF and LF are required. For details about common information headers, request headers and object headers, refer to relevant documents.

The format of the response message is as follows:

Status line Common Information Header Response Header Entity Header Message Body

The status code element consists of three digits, indicating whether the request is understood or satisfied. The Reason Analysis briefly describes the status code of the original text. The status code is used to support automatic operations, and the cause analysis is used for users. The client does not need to check or display the syntax. For details about the common information headers, the response headers and object headers, refer to relevant documents.

Protocols WWW, FTP, stmp, nntp, Gopher, WAIS, DNS, S-HTTP
Organization Source HTTP is defined in RFC 1945 and 2616 for IETF (http://www.ietf.org.
Related Links Http://www.javvin.com/protocol/rfc1945.pdf: Hypertext Transfer Protocol-HTTP 1.0
Http://www.javvin.com/protocol/rfc2616.pdf: Hypertext Transfer Protocol-HTTP 1.1

 

 

FTP: File Transfer Protocol

FTP: File Transfer Protocol
  (Ftp: File Transfer Protocol)

The file transfer protocol (FTP) allows hosts to share files. FTP uses TCP to generate a virtual connection for controlling information, and then generates a separate TCP connection for data transmission. Control connections use Telnet-like protocols to exchange commands and messages between hosts.

FTP has the following functions:

  • Provide file sharing (computer programs/data );
  • Supports indirect use of remote computers;
  • This prevents users from being affected by the differences in various host file storage systems;
  • Reliable and effective data transmission.

FTP can be directly used by end users, but its applications are mainly implemented through programs.

The FTP Control Frame refers to telnet exchange information, including Telnet commands and options. However, most FTP Control Frames are simple ASCII text, which can be divided into FTP commands or FTP messages. An FTP message is a response to an FTP command. It consists of a response code with an explanatory text.

Protocol Structure

Command Description
Abor Interrupt Data Connection Program
Acct <account> System privileged account
Allo <bytes> Allocate bytes to the file storage on the server
Appe <FILENAME> Add a file to a file with the same name on the server
Cdup <dir path> Change the parent directory on the server
CWD <dir path> Change the working directory on the server
Dele <FILENAME> Deletes a specified file on the server.
Help <command> Returns the specified command information.
List <Name> If the file name is used to list file information, if the file name is a directory, the file list is listed.
Mode <mode> Transmission Mode (S = stream mode, B = block mode, c = compression mode)
MKD <directory> Create a specified directory on the server
NLST <directory> List contents of a specified directory
Noop No action, except for the recognition from the server
Pass <password> System logon Password
PASV Request the server to wait for Data Connection
Port <address> IP address and two-byte port ID
PWD Display current working directory
Quit Log out from the FTP server
Rein Reinitialize the logon status connection
Rest <OFFSET> Restart file transmission at a specific offset
RETR <FILENAME> Retrieve (copy) files from the server
RMD <directory> Delete a specified directory on the server
RNFR <old path> Rename the old path
RNTO <New Path> Rename a new path
Site <Params> Special site parameters provided by the server
SMNT <pathname> Mount the specified file structure
Stat <directory> Returns information in the current program or directory.
Stor <FILENAME> Store (copy) the file to the server
STOU <FILENAME> Store the file to the server name
Stru <type> Data structure (F = file, r = record, P = page)
Syst Back to the operating system used by the server
Type <data type> Data Type (A = ASCII, E = ebcdic, I = binary)
User <username> User name for system Logon

The standard FTP information is as follows:

Response Code Description
110 Restart flag on the new file indicator
120 Time when the server is ready (in minutes)
125 Open Data Connection and start transmission
150 Open connection
200 Successful
202 Command not executed
211 System status reply
212 Directory status reply
213 File status reply
214 Reply to help information
215 System type reply
220 Service ready
221 Exit Network
225 Open Data Connection
226 End data connection
227 Enter passive mode (IP address, Id port)
230 Log on to the Internet
250 File behavior completed
257 Path Name Creation
331 Password required
332 Account required
350 File Suspension
421 Service closed
425 Unable to open data connection
426 End connection
450 File unavailable
451 Local Error
452 Insufficient disk space
500 Invalid Command
501 Error parameter
502 Command not executed
503 Error command sequence
504 Invalid Command Parameters
530 Network not logged on
532 An account is required to store files.
550 File unavailable
551 Unknown page type
552 Storage Allocation exceeded
553 File Name Not Allowed

Protocols Telnet
Organization Source FTP is updated by IETF (http://www.ietf.org) in RFC 959 and by 2228, 2640, and 2773.
Related Links Http://www.javvin.com/protocol/rfc959.pdf: File Transfer Protocol (FTP)

 

Pop & POP3: Post Office Protocol (Post Office Protocol version 3rd)

Pop & POP3: Post Office Protocol (Post Office Protocol version 3rd)
  Pop & POP3: Post Office Protocol

The POP protocol allows the workstation to dynamically access emails on the server. It has now reached the third edition, POP3. POP3 allows workstation to retrieve mails on the mail server. POP3 transmits data messages, which can be commands or responses.

Create a distributed email system with different technical support and channels: Pop (Post Office Protocol), DMSP (hierarchical email system protocol), and IMAP (Internet Information Access Protocol ). Among them, the POP protocol was first created and therefore most people know it. DMSP has better support for "connectionless" operations, but it is limited to a single application (pcmail) to a large extent ); IMAP provides an extended set of pop and DMSP and supports three remote email access methods: offline, online, and connectionless.

The POP protocol supports "offline" mail processing. The specific process is: the mail is sent to the server, the e-mail client calls the mail client program to connect to the server, and download all unread emails. This offline access mode is a storage and forwarding service that sends emails from the mail server to a personal terminal machine, generally PC or Mac. Once an email is sent to a PC or Mac, the email on the email server will be deleted.

POP3 does not support scaling up emails on the server. This process is completed by more advanced IMAP4. POP3 uses TCP as the transmission protocol.

Protocol Structure

POP3 is the ASCII information sent between the client and the server. POP3 command Abstract:

Command Description
User User Name
Pass User Password
Stat Email information on the server
RETR Number of retrieved information
Dele Number of deleted Information
List Number of displayed information
Top <messageid> <nombredelignes> Print x lines of information from the beginning (including the protocol header)
Quit Exit POP3 server

Optional POP3 command:

The APOP name digest authorization status is valid;

The top MSG n transaction status is valid;

UIDL [MSG]

POP3 replies:

+ OK

-Err.

Protocols SMTP, IMAP4, TCP, pop
Organization Source POP3 is defined by IETF (www.ietf.org) in RFC 1939.
Related Links Http://www.javvin.com/protocol/rfc1939.pdf:Post office protocol-Version 3

 

SMTP: Simple Mail Transfer Protocol

SMTP: Simple Mail Transfer Protocol
  (SMTP: Simple Mail Transfer Protocol)

SMTP is a reliable and effective Email transmission protocol. SMTP is a mail service modeled on the FTP file transfer service. It is mainly used to transmit mail information between systems and provide notifications related to letters.

SMTP is independent of a specific transmission subsystem and only supports reliable and ordered data stream channels. One of the important features of SMTP is its ability to transmit mail across the network, that is, "SMTP mail relay ". Generally, a network can be accessed by a TCP host on the public Internet and a host on a TCP/IP network separated by a firewall, and other hosts in the LAN/WAN are composed of Non-TCP transport layer protocol. By using SMTP, mail transmission between processors on the same network can be realized, or mail transmission between a processor and other networks can be realized through a repeater or a gateway.

In this way, the Mail may be sent through a large number of intermediate relay or gateway hosts from the sender to the acceptor path. The email exchange server of the Domain Name Service System (DNS) can be used to identify the next hop IP address of the sent mail.

Protocol Structure

The SMTP command is the ASCII information sent between SMTP hosts. The command may be as follows:

Command Description
Data Start information writing
EXPN <string> Returns the name in the specified email table.
Helo <domain> Return email server identity
Help <command> Returns the information in the specified command.
Mail from Initialize an email Session on the host
Noop No response except server response confirmation
Quit Terminate an email session
Rcpt to <user> Specify who received the email
Rset Reset email connection
Saml from Send email to user terminal and email
Send from Send email to user terminal
Soml from Send an email to your terminal or email address
Turn Exchange roles between the receiving end and the sending end
VRFY <user> Verify user identity

Protocols POP3, IMAP4, TCP, Pop, ftp
Organization Source SMTP is defined by IETF (www.ietf.org) in rfc2821.
Related Links Http://www.javvin.com/protocol/rfc2821.pdf:Simple Mail Transfer Protocol

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.